1. download PHPMailer class.
2. unzip and upload it to server.
3.
<?php
require("phpmailer/class.phpmailer.php"); // enter path to class.phpmailer.php
$mail = new PHPMailer();
$mail->IsSMTP();// use SMTP server
$mail->Host = "mail.ayola.net"; // SMTP server address
$mail->SMTPAuth = true; // turn on SMTP auth
$mail->Username = "
user@domain.com"; // SMTP username
$mail->Password = "pass"; // SMTP password
$mail->From = "
user@domain.com"; // Send FROM
$mail->FromName = "Mailer"; // Send FROM name
$mail->AddAddress("
user@domain.com","Name"); // send TO
$mail->AddReplyTo("
user@domain.com","Info"); // Reply to
$mail->WordWrap = 50;// set word wrap
$mail->IsHTML(true);// use HTML format
$mail->Subject = "Here is the subject"; // mail subject
$mail->Body = "This is the HTML body"; // mail body (as HTML)
$mail->AltBody = "This is the text-only body"; // mail body (as TXT)
if(!$mail->Send())
{
echo "Mail wasnt sent ";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Mail sent.";
?>