一开始;对不起,我的英语水平很差。我已经在努力改进了。
这是我的问题。我想用phpmailer发送一些邮件。但邮件发送者无法验证我的每个邮件账户。有趣的是两天前一切都很顺利。至少我已经尝试了脚本从自述文件和输入我的电子邮件信息,但它仍然不工作。
我现在不知道该怎么办,希望你能帮助我。
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp1.MyServer.de"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "mymail@example.com"; // SMTP username
$mail->Password = "mypass"; // SMTP password
$mail->From = "mymail@example.com";
$mail->FromName = "Mailer";
$mail->AddAddress("mymail2@example.com", "test");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
添加以下行并尝试:
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
或
$mail->SMTPSecure = "tls";
$mail->Port = 587;
希望能有所帮助