|
As of 06/17/2008, mail forms on Windows require smtp authentication, to combat form exploits that allow spammers to send email through your site. This means any existing forms which use PHP's mail() command will need to be rewrittent to use the Pear Mail functions, which allow smtp authentication, and ASP scripts will need some adjustment to CDO library calls. Here is the sample code for sending an email with PHP/Pear: <php include("Mail.php"); /* mail setup recipients, subject etc */ $recipients = "feedback@yourdomain.com"; $headers["From"] = "user@someotherdomain.com"; $headers["To"] = "feedback@yourdomain.com"; $headers["Subject"] = "User feedback"; $mailmsg = "Hello, This is a test."; /* SMTP server name, port, user/passwd */ $smtpinfo["host"] = "localhost"; $smtpinfo["port"] = "25"; $smtpinfo["auth"] = true; $smtpinfo["username"] = "smtpUsername"; $smtpinfo["password"] = "smtpPassword"; /* Create the mail object using the Mail::factory method */ $mail_object =& Mail::factory("smtp", $smtpinfo); /* Ok send mail */ $mail_object->send($recipients, $headers, $mailmsg); ?> And here is a sample using ASP/CDO: Dim objMessage
Set objMessage = Server.CreateObject("CDO.Message")
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpusessl")= False
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") _ = cdoBasic
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusername") _ = "smtpUsername"
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendpassword") _ = "smtpPassword"
objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objMessage.Configuration.Fields.Update
With objMessage .To = "Test " .From = "Bob " .Subject = "This is the mail subject" .TextBody = "This is the mail message." .Send End With
|