Example of sending a simple email with CDO. Very simple. Include:
Const cdosendusingmethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdosendusingport = 2
Const cdosmtpserver = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdosmtpserverport = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdosmtpconnectiontimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdosmtpauthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdobasic = 1
Const cdosendusername = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdosendpassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
Dim objconfig 'as CDO. Configuration
Dim objmessage 'as CdO. Message
Dim fields 'As ADODB. Fields
Set objconfig = server. Createobject ("CDO. Configuration ")
Set fields = objconfig. Fields
With fields
. Item (cdosendusingmethod) = cdosendusingport
. Item (cdosmtpserver) = "mail.cccar.com.cn" 'smtp server address
. Item (cdosmtpserverport) = 25
. Item (cdosmtpconnectiontimeout) = 10
. Item (cdosmtpauthenticate) = cdobasic
. Item (cdosendusername) = "username" 'sender's username
. Item (cdosendpassword) = "password" 'sender's password
. Update
End
Set objmessage = server. Createobject ("CDO. Message ")
Set objmessage. Configuration = objconfig
With objmessage
. To = "ljc@cccar.com.cn" 'recipient's email address
. From = "ljc@cccar.com.cn" 'the sender's email address
. Subject = "Test of CdO sending email in ASP" 'mail title
. Textbody = "my email test, this email is sent by CDO" 'body of the email
. Cc = ljc@oa.cccar.com.cn; sxy@cccar.com.cn 'CC address
. Send
End
Set fields = nothing
Set objmessage = nothing
Set objconfig = nothing