SMTP Mail Send From Localhost/ live Server

 <?php

include('smtp/PHPMailerAutoload.php');

echo smtp_mailer('user-email-id','email-subject','message body');

function smtp_mailer($to,$subject, $msg){

$mail = new PHPMailer(); 

$mail->SMTPDebug  = 3;

$mail->IsSMTP(); 

$mail->SMTPAuth = true; 

$mail->SMTPSecure = 'tls'; 

$mail->Host = "smtp.gmail.com";

$mail->Port = 587; 

$mail->IsHTML(true);

$mail->CharSet = 'UTF-8';

$mail->Username = "kanhabazar21@gmail.com"; //admin gmail

$mail->Password = "djkanha890"; //admin gmail password

$mail->SetFrom("kanhabazar21@gmail.com"); //admin gmail

$mail->Subject = $subject;

$mail->Body =$msg;

$mail->AddAddress($to);

$mail->SMTPOptions=array('ssl'=>array(

'verify_peer'=>false,

'verify_peer_name'=>false,

'allow_self_signed'=>false

));

if(!$mail->Send()){

echo $mail->ErrorInfo;

}else{

return 'Sent';

}

}

?>

smtp files download -  Download Full Source Code

google captha linkClick Here

Post a Comment

0 Comments