Search these files on google you will be redirected to github, Download the code from there.
1) class.smtp.php 2) class.phpmailer.php
Include these two files in the page sendemail.php (code given below)
require_once('class.phpmailer.php');
require_once('class.smtp.php');
require_once('upass.php');
function sendEmail($to, $subject,$message){
$mail = new PHPMailer(); // defaults to using php "mail()"
$name = explode('@',$to);
$body = "Your email body goes here";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
global $username;
global $password;
$mail->Username = $username;
$mail->Password = $password;
$mail->CharSet = 'UTF-8';
$mail->AddReplyTo("abc@abc.ae.com", "Notification");
$mail->SetFrom('abc@abc.ae.com', 'Notification');
$address = $to;
$mail->AddAddress($address, $name[0]);
$mail->Subject = $subject;
//$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
if (!$mail->Send()) {
//echo "Mailer Error: " . $mail->ErrorInfo;
} else {
//echo "Message sent!";
}
}
//File upass.php code given below
<?php
$username = "abc@abc.come"; // GMAIL username
$password = "xyz"; // GMAIL password
?>