File: /home/cafsindia/hrms_allyindian_com/mail_tester/index.php
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
require('./phpmailer/class.phpmailer.php');
//echo "BSK"; die;
$to_email = 'smarthrmscloud@gmail.com';
$subject = 'Test';
$email_content = "Test";
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer();
try{
$mail->IsSMTP();
$mail->SMTPDebug = 3;
$mail->Host = "smtp.gmail.com"; // Your SMTP PArameter
$mail->Port = 587; // Your Outgoing Port
$mail->SMTPAuth = true; // This Must Be True
$mail->Username = "smarthrmsmailer@gmail.com"; // Your Email Address
$mail->Password = "jjxnaouenrdqdwxe"; // Your Password
$mail->SMTPSecure = 'tls'; // Check Your Server's Connections for TLS or SSL
$mail->From = 'smarthrmsmailer@gmail.com';
$mail->FromName = 'smarthrmsmailer@gmail.com';
if($to_email){
$mail->AddAddress($to_email);
}
$mail->IsHTML(true);
$mail->Subject=$subject;
$mail->Body=$email_content;
//$mail->addAttachment('uploads/1user_view1.png'); // Add attachments
//$mail->addAttachment('uploads/report.pdf'); // Add attachments
//echo "BSK"; die;
//$mail->Send();
if($mail->Send()){
echo "Mail Sent";
}else{
echo 'Mailer Error: ' . $mail->ErrorInfo;
echo "Not Sent";
}
//End Send mail to customer
}catch(phpmailerException $e){
echo $e->errorMessage(); //Pretty error messages from PHPMailer
}catch(Exception $e){
echo $e->getMessage(); //Boring error messages from anything else!
}
?>