Right now when I use this to send a 1.5Mb PDF to 200 recipients, it bails about half-way through. I've got php execution timeout and input timeout turned up to ridiculous levels and I believe it's b/c of the file attach that it's having issues as the script works well w/o a file attachment or when the attachment is around 200k (which is the normal size).
Code: Select all
foreach($ToList as $User)
{
if ($_POST['attachment'] != 0)
{
$Attachment = Swift_Attachment::fromPath('attach/'.$Files[$_POST['attachment']]);
$Transport = Swift_MailTransport::newInstance();
$Mailer = Swift_Mailer::newInstance($Transport);
$Message = Swift_Message::newInstance($_POST['subject'])
->setFrom(array($From))
->setTo(array($User))
->setBody($_POST['message'])
->attach($Attachment)
;
} else {
$Transport = Swift_MailTransport::newInstance();
$Mailer = Swift_Mailer::newInstance($Transport);
$Message = Swift_Message::newInstance($_POST['subject'])
->setFrom(array($From))
->setTo(array($User))
->setBody($_POST['message'])
;
}
$Result = $Mailer->send($Message);
}