我正在使用PHPMailer类发送带附件的电子邮件。邮件 发送成功但$ mail-> Send()方法在我没有返回时 连接到移动分组数据。即我没有得到成功或失败的消息。有趣的是,当我连接到Wifi DSL线路时,代码工作正常。我的剧本是......
require ("PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'TLS';
$mail->Host = "smtp.office365.com";
$mail->Port = 587;
$mail->IsHTML(true);
$mail->Username ="xxx";
$mail->Password = "xxx";
$mail->SetFrom("from@mydomin.com","my name");
$mail->Subject = "My Subject";
$mail->Body = "Hi";
$mail->AddAddress("tomail@otherdomain.com");
$mail->AddBCC("tomail@otherdomain.com");
$file1 = "path/to/file1.pdf";
$file1 = "path/to/file2.pdf";
$file1 = "path/to/file3.pdf";
$mail->AddAttachment($file1);
$mail->AddAttachment($file2);
$mail->AddAttachment( $file2);
if(!$mail->Send())
{
echo "succeed";
}
else
{
echo "failed";
}