我正在尝试将文件作为电子邮件附件发送,但由于某种原因,如果文件大于 100k,那么即使我收到电子邮件发送的消息,电子邮件也不会通过。
这也可能是 IIS smtp 设置中对附件的限制,但是当我取消选中限制会话大小和限制邮件大小选项时,它并没有改变任何东西。今晚我可能不得不重新启动服务器...
我不知道这是不是 php.ini 设置,还是什么。
<?
$path_of_attached_file = "Images/marsbow_pacholka_big.jpg";
require 'include/PHPMailer_5.2.1/class.phpmailer.php';
try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
$body = $message; //"<p><b>Test</b> another test 3.</p>";
$mail->AddReplyTo("admin@example.com","Admin");
$mail->From = "admin@example.com";
$mail->FromName = "Admin";
$mail->AddAddress($to);
$mail->Subject = "First PHPMailer Message";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
if($attach){
$mail->AddAttachment($path_of_attached_file);
}
$mail->Send();
echo 'Message has been sent.';
} catch (phpmailerException $e) {
echo $e->errorMessage();
}
?>