[PHP] Attachments again
Hi, When i send a dynamic HTML newletter, which contains newsitems in the database I now send the e-mail with a link to the image on the webserver. What i would like to do is instead of linking the image, send the image as a sort of attachment. So an internetconnection is not required when viewing the e-mail. Is this possible and how should I do this? Thanks in advance, Sjoerd Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Attachments again
I've found a great SMTP class file that supports file attachments. Its just a few lines of code that base64_encode's the attachment, and sticks it at the end of the email. I guess just rip whatever code ya need out of this, for doing attachments, and insert it into your own. Maybe do a little RFC reading to figure out multiple atachments. =) (sendmsg() Copyright © 2001 Wanja Hemmerich) ? function sendmsg($to, $subject, $text, $from, $file, $type) { $content = fread(fopen($file,r),filesize($file)); $content = chunk_split(base64_encode($content)); $uid = strtoupper(md5(uniqid(time(; $name = basename($file); $header = From: $from\nReply-To: $from\n; $header .= MIME-Version: 1.0\n; $header .= Content-Type: multipart/mixed; boundary=$uid\n; $header .= --$uid\n; $header .= Content-Type: text/plain\n; $header .= Content-Transfer-Encoding: 8bit\n\n; $header .= $text\n; $header .= --$uid\n; $header .= Content-Type: $type; name=\$name\\n; $header .= Content-Transfer-Encoding: base64\n; $header .= Content-Disposition: attachment; filename=\$name\\n\n; $header .= $content\n; $header .= --$uid--; mail($to, $subject, , $header); return true; } ? -- From PHPGalaxy.com, earn up to $10 per order selling our PHP Scripts and Software on your Site. http://www.phpgalaxy.com/aff/ Also, get a fast free POP3 email account, you @php.la at http://www.phpgalaxy.com/search/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Attachments again
On the attachment subject, does anyone know how to specify multiple mime types? I have my attachment script, however people may be using it to send gifs, swfs, or text files I am specifyinmg the mime types like this $type = image/gif; $header .= Content-Type: $type; wuld I do something like turn $type into an array or do something like $type = image/gif | mimetype/2 | mimetype/3 | mimetype/4; THis doesnt seem to work (obviously mimetype/ * = a specified mime type) Thanks in advance for any suggestions Caspar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Attachments again
Hi Sjoerd, When i send a dynamic HTML newletter, which contains newsitems in the database I now send the e-mail with a link to the image on the webserver. What i would like to do is instead of linking the image, send the image as a sort of attachment. So an internetconnection is not required when viewing the e-mail. I use www.phpguru.org's, HTML MIME class. Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]