CDOSYS not sending email - code correct?!?!?
Posted on 2007-04-04
I have setup a form which I want sending using CDOSYS. It all appears to be working fine and the confirmation page shows no errors - however no email is sent and I do not know why! The code appears to be all correct!
This is the code:
'First lets Dim all the variables we need - this is a comment
'Now lets get some values for the variables from the form
MyName = Request.Form("Name")
MyAddress = Request.Form("Address")
MyPostcode = Request.Form("Postcode")
MyTelephone = Request.Form("Telephone")
MyEmail = Request.Form("Email")
MyMessage = Request.Form("Message")
'Now lets build the body of the email from the data in the form
MyBody = "Name: "& MyName & vbcrlf
MyBody = MyBody & "Address: "& MyAddress & vbcrlf
MyBody = MyBody & "Postcode: "& MyPostcode & vbcrlf
MyBody = MyBody & "Telephone: "& MyTelephone & vbcrlf & vbcrlf
MyBody = MyBody & "Email: "& MyEmail & vbcrlf
MyBody = MyBody & "Message: "& MyMessage & vbcrlf
'Now lets put the variables and other information we need into the mailing script
Set MyMail = CreateObject("CDO.Message")
MyMail.From = "firstname.lastname@example.org"
MyMail.To = "email@example.com"
MyMail.Subject = "Website Enquiry from Fama.co.uk"
MyMail.TextBody = MyBody
Set MyMail= nothing
Response.Write("Your e-mail has been sent")