Forum Moderators: open
Could you please look at the following script and let me know where i am doing wrong.
<%
'Dimension variables
'Dim objCDOSYSCon , objCDOSYSMail, Body
Dim myCon , myMail, Body
'Create the e-mail server object
Set myMail = Server.CreateObject("CDO.Message")
Set myCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
myCon.Fields.Update
'Update the CDOSYS Configuration
Set myMail.Configuration = myCon
myMail.From = "info@yahoo.com"
myMail.To = "test@yahoo.com"
myMail.Subject = "Your Subject"
Body = "Dear " + "User"+ ","
Body = Body + " <html>"
Body = Body + " <body>"
Body = Body + "<p>Your Mail script is working fine."
Body = Body + "...</p> "
Body = Body + "</body></html> "
'Close the server mail object
Set myMail = Nothing
Set myCon = Nothing
Response.Write("Your mail was sent")
%>
Thanks,
VJ
At first glance I can see a major flaw, which is that you don't actually send the email!
myMail.Send
There is also no body to the email:
myMail.HTMLBody = Body
So to recap, right before the line "'Close the server mail object" you need to add:
myMail.HTMLBody = Body
myMail.Send
Dixon.