Please use the PHP Pear mail authentication, this is to prevent spammer to access the php normal mail() function which is insecure.
Please download the package on http://pear.php.net/package/Mail and then copy it to your working folder on the webserver. After that you have to include the files on your PHP. Please refer to this for more reference.
http://www.cyberciti.biz/tips/howto-php-send-email-via-smtp-authentication.html
This is the sample code
include("Mail.php");
/* mail setup recipients, subject etc */
$recipients = "feedback@yourdot.com";
$headers["From"] = "user@somewhere.com";
$headers["To"] = "feedback@yourdot.com";
$headers["Subject"] = "User feedback";
$mailmsg = "Hello, This is a test.";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "smtp.mycorp.com";
$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);
?>
- 40 Users Found This Useful