如何在xampp上使用phpmailer发送邮件 [英] how to send mail using phpmailer on xampp
本文介绍了如何在xampp上使用phpmailer发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直试图在xampp上使用php mailer发送邮件,但确实收到此错误消息 无法发送消息. Mailer错误:以下发件人"地址失败:xxxx2@gmail.com:未连接就调用Mail()
I have been trying to send a mail using php mailer on xampp and i do get this error saying Message could not be sent. Mailer Error: The following From address failed: xxxx2@gmail.com : Called Mail() without being connected
请,我需要有关如何解决此问题的帮助. 这是我的代码;
please, i need help on how to fix this. Here is my code;
<?php
require( 'class.phpmailer.php' );
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "tls://smtp.gmail.com";
$mail->Port = 25;
$mail->Username = "xxxx@gmail.com";
$mail->Password = "xxxxx";
//Sending the actual email
$mail->setFrom('xxxx2@gmail.com', 'Aaron');
$mail->addAddress('xxxx2@gmail.com', 'Aaron'); // Add a recipient
$mail->isHTML(false); // Set email format to HTML
$mail->Subject = 'Calculation form results from ';
$mail->Body = 'testing...';
if(!$mail->send()) {
echo 'Message could not be sent. ';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
?>
推荐答案
从
这篇关于如何在xampp上使用phpmailer发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文