<% ' mail-cdo-test.asp dim sn sn = "myServer" dim PageName PageName = "Test outgoing CDO mail functionality" response.write "

" & PageName & "

" response.write "

... from: " & sn & "

" response.write "

Timestamp: " & now & "

" dim sMessage ' As string sMessage = "Contact has been made." & vbCrLf & "This is a test message from the cdo script on [" & sn & "]." & vbCrLf Dim objConfig ' As CDO.Configuration Set objConfig = Server.CreateObject("CDO.Configuration") Dim Fields ' As ADODB.Fields Set Fields = objConfig.Fields ' Set configuration fields we care about With Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort ' send method .Item(cdoSMTPServerPort) = 25 ' smtp port # .Item(cdoSMTPConnectionTimeout) = 20 ' Connection Timeout .Item(cdoSMTPAuthenticate) = cdoBasic ' basic authentication .Item(cdoSMTPServer) = "smtp.example.com" ' a real smtp server .Item(cdoSendUserName) = "example@example.com" ' a real user name .Item(cdoSendPassword) = "password" ' a real password .Update End With response.write "" Set Fields = Nothing Dim objMessage ' As CDO.Message Set objMessage = Server.CreateObject("CDO.Message") Set objMessage.Configuration = objConfig Set objConfig = Nothing With objMessage .To = "My Test Address " .From = "webapp@example.com" ' mail address for the account .ReplyTo = "webapp@example.com" ' r/t can be different address .Subject = "test from cdo on [" & sn & "]." .TextBody = sMessage End With response.write "

Sending mail to: " & objMessage.To & "

" response.write "

Sending mail cc: " & objMessage.CC & "

" response.write "

Subject: " & objMessage.Subject & "

" response.write "

Message content:..

" & objMessage.TextBody & "
" response.write "

Timestamp: " & now & "

" on error resume next objMessage.Send select case err.number case 0 Response.Write "

Success ... message sent

" case else Response.Write "

Send failed, error is ...

" Response.Write "" err.clear end select on error goto 0 Set objMessage = Nothing response.write "

That's all folks ....

" response.write "

Timestamp: " & now & "

" %>