ASP Email Code

Like others I have some email scripts that no longer work which have worked for quite some time now.

I am wondering what is it that has broken email scripts that have worked for quite some time now.

Doesn't seem to matter what code I use the emails do not go through. I do have one site that he email script works on but copying it to another server and reconfiguring it does not help.
 
I found lately that I have to explicitly specify port 587 in ASP code for SMTP mail. Otherwise, the script would take much longer and sometimes time out.
 
If i am understanding your problem, then I think you have to use php to send this.So to send a simple sample message, like:

<?php
$to = "[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
hope this will help you.
 
Here is some simple asp code that works. To avoid being marked as spam, make sure the From e-mail address is on the same domain as your site. Use the replyto if you want to fill it in with a field value from the form.

Code:
Dim ObjSendMail
		Set ObjSendMail = CreateObject("CDO.Message")

		'This section provides the configuration information for the remote SMTP server.

		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="YOUR MAIL SERVER"
		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

		' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="YOUR EMAIL ADDRESS"
		ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="YOUR PASSWORD"

		ObjSendMail.Configuration.Fields.Update


		txtReplyTo= request("FirstName") & " " & request("LastName") & "<" & Request("EMail") & ">"
		ObjSendMail.To = SendMailTo
		ObjSendMail.From = txtFromName
		ObjSendMail.ReplyTo = txtReplyTo
		ObjSendMail.Subject = SendMailSubj
		ObjSendMail.HTMLBody = emailbody

		ObjSendMail.Send
 
Back
Top