Friday 7 July 2017

smtp mail using phpmailer and zoho

<?php

require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 3;
$mail->SMTPAuth = true;
$mail->Host = "smtp.zoho.com";
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->Username = "fullmail@domain.com";
$mail->Password = "12345678";


$mail->SetFrom('fullmail@domain.com', 'Web App');
$mail->Subject = "A Transactional Email From Web App";
$mail->MsgHTML('test');
$mail->AddAddress('fullemail', 'name');
if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

No comments:

Post a Comment

Please share your thought about this