File: /home/cafsindia/hrms_patroniss_com/mail_tester/index - Copy.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 = 'sathish@cafsinfotech.in';
$subject = 'Test';
$email_content = "";
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer();
try{
$mail->SMTPDebug = 3;
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com"; // Your SMTP PArameter
$mail->Port = 587; // Your Outgoing Port
$mail->SMTPAuth = true; // This Must Be True
$mail->Username = "patroniss.2020@gmail.com"; // Your Email Address
$mail->Password = "cafs@1234"; // Your Password
$mail->SMTPSecure = 'tls'; // Check Your Server's Connections for TLS or SSL
$mail->From = 'patroniss.2020@gmail.com';
$mail->FromName = 'patroniss.2020@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
$mail=$mail->Send();
//End Send mail to customer
echo "Mail Sent";
}catch(phpmailerException $e){
echo $e->errorMessage(); //Pretty error messages from PHPMailer
}catch(Exception $e){
echo $e->getMessage(); //Boring error messages from anything else!
}
?>