Forum Moderators: open

Message Too Old, No Replies

CDOSYS email script

Not delivering the email

         

edeals2day

11:13 pm on Jul 24, 2005 (gmt 0)

10+ Year Member



I am having problem in the following CDOSYS email script, i couldn't find the problem in this script but its not delivering the email to the target.

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

petehall

4:03 pm on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This has been posted in the wrong section.

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

Receptional

4:12 pm on Jul 26, 2005 (gmt 0)



So... My programming skills are poor enough not to know if I have moved this to the right forum - but hopefully it is more or less in the right place now!

Dixon.

petehall

4:21 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Spot on Receptional!

edeals2day

4:09 am on Jul 27, 2005 (gmt 0)

10+ Year Member



Thanks for your reply