Page 1 of 1

attachments using phpmailer

Posted: Mon Jun 09, 2008 3:23 am
by kkonline
hi all,
I am using the phpmailer to send an attachment(3MB) to to all the members in the database, however in doing so, i receive the following error Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4680430 bytes) in /home/mysite/public_html/dir1/phpmailer/class.smtp.php on line 308

Code: Select all

 
$mail->FromName = "mysite.org";
$mail->From = "noreply@mysite.org";
$mail->AddReplyTo("noreply@mysite.org", "mysite");
 
$mail->Subject = $subject;
$mail->Body = $message;
$mail->WordWrap = 65;
 
$sql = "SELECT * FROM invites_test WHERE `invitation` = 0 LIMIT 0, 3";
$result = mysql_query($sql) or die(mysql_error());
 
//attachment
$mail->AddAttachment("/home/mysite/public_html/dir1/dir/attach.zip", "attach.zip");
//attachment
 
while($row = mysql_fetch_array($result)){
$email=$row['email'];
$mail->AddAddress($row['email']);
 
$mail->Send();
mysql_query("UPDATE invites_test SET invitation = 1 WHERE email LIKE '".$email."%'");
$mail->ClearAddresses();
}
echo 'Invitation has been sent.';
?>
The purpose is to send attachment to all the members