Sending Email Using CDOSYS Object

The following code will send email using CDOSYS object.

Dim objMail
Dim objConfig
Dim objFields

Set objMail = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.configuration")

Set objFields = objConfig.Fields

With objFields
 .Item("
http://schemas.microsoft.com/cdo/configuration/sendusing")  =  2
 .Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver")  =  "mail.oissite.com"
 .Item("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") =  25
 .Update
End With


With objMail
  Set .Configuration = objConfig
      .To            = """Some Name"" <
someone@domain.com>"
      .From          = """Your Name""
youraddress@domain.com"
      .Subject       = "This is a test"
      .Send
End With

  • 1 Users Found This Useful
Was this answer helpful?