This is a discussion on Sending multipart html emails with PHP script within the PHP Language forums, part of the PHP Programming Forums category; Hi to all, After hours of attempts and "googling", I'm still pulling my hair off my head ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi to all,
After hours of attempts and "googling", I'm still pulling my hair off my head when I try to send multipart html emails. It "works" on PCs with Outlook when I juste send a single "related" mail: one part for the HTML body, and several for the images. However, the images do not show on a Mac. I also wanted to have an "alternate", plain text message. I've tried the method described by Zend and PHPBuilder, but no luck... I've included a sample of what the email looks like in the end. Questions: what is the best way to organize the multiparts? Where does the header stop and the message start ? Many thanks in advance ! BR, Damien MIME-Version: 1.0 From: "Me" <me@truc.net> Subject: My subject Content-Type: multipart/alternative; boundary="PIEALT57206" This is a mulipart message in mime format --PIEALT57206 Content-Type: text/plain;Content-Transfer-Encoding: 8bit; charset="iso-8859-1" Your mail software is not HTML.... --PIEALT57206 Content-Type: multipart/related; boundary="PIEREL57206" --PIEREL57206 Content-Type: text/html Content-Transfer-Encoding:8bit (html code here) --PIEREL57206 Content-Type: image/jpeg; name="logo.jpg" Content-Transfer-Encoding: base64 Content-Description: "Image num.9" Content-ID: Image9 (base64 encoded image) --PIEREL57206-- --PIEALT57206-- |
|
|||
|
Hello,
On 11/15/2004 01:51 PM, Damien wrote: > Hi to all, > After hours of attempts and "googling", I'm still pulling my hair off my > head when I try to send multipart html emails. > > It "works" on PCs with Outlook when I juste send a single "related" > mail: one part for the HTML body, and several for the images. However, > the images do not show on a Mac. > > I also wanted to have an "alternate", plain text message. I've tried the > method described by Zend and PHPBuilder, but no luck... > > I've included a sample of what the email looks like in the end. > > Questions: what is the best way to organize the multiparts? Where does > the header stop and the message start ? I suspect that the part separators are wrong. Anyway, if I were you I would not re-invent the wheel and use existent classes for composing and sending HTML messages with embededed images and alternate part texts like this one: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html |
|
|||
|
Manuel Lemos wrote:
(snip) > I suspect that the part separators are wrong. In what way ? I've tried "simple" ones and some generated from md5(uniqid... > Anyway, if I were you I would not re-invent the wheel and use existent > classes for composing and sending HTML messages with embededed images > and alternate part texts like this one: > > http://www.phpclasses.org/mimemessage Thanks for the link, but I need to customize the body before it is sent. For now, adapting the code is a bit over my head. Any other idea ? BR, Damien -- "Disk that's so old it's got marks from Noah's screwdriver on the side. " BOFH |