Because of the large amount of spam email that occurs every day, our email servers need to restrict how email gets sent. Normally in PHP, you would use the mail function to send out an email. Below is an example of how the mail function works:
$to = 'somebody@somewhere.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: email@yourdomain.com';
mail($to, $subject, $message, $headers);
This will no longer work. Replace the above code with the PHP Class called PHPMailer which you can download from here. Here is an example of PHPMailer that would replace the above mail code:
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "mail.yourdomain.com"; // Outgoing Mail (SMTP) server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "email@yourdomain.com"; // SMTP username
$mail->Password = "yourpassword"; // SMTP password
$mail->From = "email@yourdomain.com";
$mail->FromName = "Your Name";
$mail->AddAddress("somebody@somewhere.com");
$mail->IsHTML(false); // send as plain text
$mail->Subject = "the subject";
$mail->Body = "hello";
if(!$mail->Send())
{
echo "Message was not sent ";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";