【发布时间】:2012-05-04 18:06:29
【问题描述】:
我正在尝试将文件作为电子邮件附件发送,但由于某种原因,如果文件大于 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();
}
?>
【问题讨论】: