Wednesday, April 6, 2011

Sending Mail using CDOSYS

<%
dim returnCode
SendMail
if returnCode = True then
'Put your code when mail send successfull
else
'Put your code when mail could not send end if
sub SendMail()
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Send test Mail using CDOSYS"
myMail.From="name@yourdomain.com"
myMail.To="name@yourdomain.com"    'You can also use comma separated Mail
myMail.HTMLBody="Hi

How r you.

Test mail sending Program

" myMail.Configuration.Fields.Item _("http://schemas.microsoft.com/cdo/configuration/sendusing")=2 'Name or IP of remote SMTP server myMail.Configuration.Fields.Item _("http://schemas.microsoft.com/cdo/configuration/smtpserver")="localhost" 'Server port myMail.Configuration.Fields.Item _("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 myMail.Configuration.Fields.UpdateOn Error Resume Next myMail.Send If Err.Number = 0 then returnCode=True Else returnCode=False End If set myMail=nothing end sub %>
Share: