require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure="tls";
$mail->Host = "smtp.mail.yahoo.com";
$mail->Port = 587;
$mail->Username = "********@yahoo.com";
$mail->Password = "*****";
$mail->SetFrom('*********@yahoo.com', 'my name');
$mail->Subject = "A Transactional Email From Web App";
$mail->MsgHTML('text');
$mail->AddAddress('*********@yahoo.com', 'my name');
if($mail->Send()) {
echo "Message sent!";
}else {
echo "Mailer Error: " . $mail->ErrorInfo;
}
So, I try to send an Email with PHPMailer, but the code it does not work,the localhost page isn't working. I copied class.phpmailer.php and class.smtp.php to /var/www/html folder (Before I specified the path in require_once (/usr/share/...)). I enabled ssl extension. I use Ubuntu 16.04 and I installed libphp-phpmailer. What should I do? (Any options to send mail with smtp would be apreciated, already tried: postfix and sendmail).