サイズが 2MB を超えるメール添付ファイルを送信しようとしていますが、 「致命的なエラー: 31457280 バイトの許容メモリ サイズが使い果たされました」というエラーが表示されます。 私も次のことを試しました
memory_limit =30M
max_execution_time =3600
post_max_size = 20M
upload_max_filesize = 20M
php.ini file.bt では機能しません。
<?php
//sending Email using SMTP server
include "phpmailer/class.smtp.php";
include "phpmailer/class.phpmailer.php";
$Host = "mail.gmail.com"; // SMTP servers
$Username = "YourEmail@gmail.com"; // SMTP password
$Password = "******"; // SMTP username
$From = "YourEmail@gmail.com";
$FromName = "Your Name";
////multilple mail id
$str =$_SESSION['MailAll'];
$arr=explode(",",$str);
$Tos=$arr;
$Ccs = array(
"CC Name 1" => "cc-email-1@yahoo.com",
"CC Name 2" => "cc-email-2@gmail.com"
);
$Subject ="Project Abstract";
///Message Body
$Body =$_POST['mailcont'] ;;
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = $Host;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = $Username;
$mail->Password = $Password;
$mail->From = $From;
$mail->FromName = $FromName;
foreach($Tos as $key => $val){
$mail->AddAddress($val , $key);
}
$mail->WordWrap = 50; // set word wrap
$mail->Priority = 1;
$mail->IsHTML(true);
///// Multiple attachment file pass to $arr by $str
$str=$_SESSION['DOCFILE'];
$arr=explode(",",$str);
for($i=0;$i<count($arr)-1;$i++){
$mail->AddAttachment($arr[$i]);
}
$mail->Subject = $Subject;
$mail->Body = $Body;
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
header('location:sendABS.php');
// echo 'Message has been sent.';
}
?>