Sending multipart html emails with PHP script

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-15-2004
Damien
 
Posts: n/a
Default Sending multipart html emails with PHP script

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--
Reply With Quote
  #2 (permalink)  
Old 11-15-2004
Manuel Lemos
 
Posts: n/a
Default Re: Sending multipart html emails with PHP script

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
Reply With Quote
  #3 (permalink)  
Old 11-17-2004
Damien
 
Posts: n/a
Default Re: Sending multipart html emails with PHP script

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0