0
votes

I've the following classic ASP code to send email using SMTPsvg.Mailer :

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName   = "From Name"
Mailer.FromAddress= "[email protected]"
Mailer.RemoteHost = "mail.test.com"
Mailer.AddRecipient "inquiry", "[email protected]"
Mailer.Subject    = "Contact Request"

I'm trying to convert it to use CDOsys, but the CDOsys object doesn't seem to have FromName, RemoteHost attributes as per the documentation here:

http://msdn.microsoft.com/en-us/library/ms526367(v=exchg.10).aspx

Is it possible that the remote host is automatically included when using CDOsys ?

1

1 Answers

1
votes

For the from address you can specify a from name and address using the "From" property, like this:

myMail.From="""Sender Name"" <[email protected]>"

Note that the name is enclosed in double quotes.

If you don't specify a mail server, CDOSYS uses the default server (localhost, port 25). To specify a different server you need to use ConfigurationFields, like this:

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update