Re: sending big email attachments
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 17 Nov 2000 20:52:23 +0000 |
| Subject: | Re: sending big email attachments | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25958@lists.php.net to get a copy of this message | ||
On Fri, 17 Nov 2000, Juan Luis Baptiste wrote:
> Hi,
>
> I need to send an 650k email attachment, for that I'm using a class called
> CWMailFile.php. I have used it before for smaill attachments (50K) without
> any problem, but sometimes the script times out and others not.
>
> Also, it takes arround 5 minutes to send only two emails, and I got to send
> ~=2500 emails so you can think the LOT of time it could take. Any body can
> give a better solution? doesn't matter if it's not php related.
>
> Thanks a lot.
>
Try this:
<?php
$boundary="---".md5(rand());
$headers="MIME-Version: 1.0\n";
$headers.="Content-Type: MULTIPART/MIXED; BOUNDARY=\"$boundary\"\n";
$message=" This message is in MIME format. The first part should";
$message.=" be readable text,\n while the remaining parts are";
$message.=" likely unreadable without MIME-aware tools.\n Send mail";
$message.=" to mime@docserver.cac.washington.edu for more info.\n\n";
$message.=$boundary+"\nContent-Type: TEXT/PLAIN\n";
$message.=$body."\n\n"+$boundary+"\nContent-Type: ".$mimetype."\n";
$message.="Content-Transfer-Encoding: BASE64\n";
$message.="Content-Description: \"Mail Attachment\"\n";
$message.="Content-Disposition: attachment; filename=\"$filename\"\n\n"
$message.=base64_encode($content);
mail($to, $subject, $message, $headers);
?>
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>