Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function sendTestEmail(){
- $mail = new PHPMailer;
- //$mail->SMTPDebug = 3; // Enable verbose debug output
- $mail->isSMTP(); // Set mailer to use SMTP
- $mail->SMTPOptions = array(
- 'ssl' => array(
- 'verify_peer' => false,
- 'verify_peer_name' => false,
- 'allow_self_signed' => true
- )
- );
- $mail->SMTPAuth = true; // Enable SMTP authentication
- //$mail->SMTPDebug=2;
- $mail->Host = 'mail.pgpriorcargo.com'; // Specify main and backup SMTP servers
- $mail->Password = '1q2w3e4r5t'; // SMTP password
- //$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
- $mail->Subject = 'Priorcargo pending materials';
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
- $mail->isHTML(true);
- /*$headers = "MIME-Version: 1.0" . "\r\n";
- $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
- $headers .= "From: [email protected]" . "\r\n" .
- "Reply-To: [email protected]" . "\r\n" .
- "X-Mailer: PHP/" . phpversion();
- $mail->addCustomHeader($headers);*/
- $template=file_get_contents(Config::PATH."/views/emailtemplates/test.html");
- //$mail->addAddress("[email protected]", "Veeru PV");
- $mail->MsgHTML($template);
- //$mail->Body=$template;
- $response=array();
- if(!$mail->send()){
- $response["status"]=0;
- $response["message"]="Error sending email";
- }else{
- $response["status"]=1;
- $response["message"]="Email sent";
- }
- echo json_encode($response);
- }
Advertisement
Add Comment
Please, Sign In to add comment