Sending e-mail from script error

In ASP code I’m using CDO to send e-mails. However now now I get an error returned saying:

Error occured: The “SendUsing” configuration value is invalid

The code itself hasn’t been changed and I’m not updating the SendUsing field in CDO.. Here is the piece of code that produce the error:

set Mail = Server.CreateObject("CDO.Message")
With Mail
  .To = "somewhere"
  .From = "[email protected]" 
  .ReplyTo = email
  .Subject = "Subject"
  .AutoGenerateTextBody = True
  .HTMLBody = strHTML
  On Error Resume Next
  .Send
  If Err then strError = "Error occured: " & Err.Description
  On Error Goto 0
End With
set Mail = nothing

If you specify your smtp server - mail.stpworks.com, it will start working. For some reason, it won’t use the local SMTP server to send the mail. We’ll look into this on Jan 1.

I had the same problem when my site moved to the new server. Setting the smtpserver property fixed the problem. See:
http://support.jodohost.com/showthread.php?t=774

riley

Ok, thank you, will do :slight_smile:

[QUOTE=Yash]
If you specify your smtp server - mail.stpworks.com, it will start working. For some reason, it won’t use the local SMTP server to send the mail. We’ll look into this on Jan 1.
[/QUOTE]
How does one specify the smtp server when using StPatrick’s code sample above? (in classic ASP)

Thanks.

EDIT: Never mind. I found a web page with several great examples of using VBScript and CDO for e-mail. None of them require specifying the SMTP server and they work great.

http://www.paulsadowski.com/WSH/cdo.htm