472,989 Members | 3,131 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

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--
Jul 17 '05 #1
2 3144
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
Jul 17 '05 #2
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
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ann | last post by:
Hi, I am trying to send a html email from a php script. This script emails a common information to all the members in the database. The only problem is I cannot specify colors, hyperlinks...
5
by: lucanos | last post by:
Hey All, I'm having trouble trying to create a PHP file which will generate a multipart email message (containing both an HTML formatted part and a Plain Text formatted part). I have Googled...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
8
by: windandwaves | last post by:
Hi Folk I want to send out a basic newsletter from my MySql database of contacts. Does anyone know a nice and simple bit of PHP that allows me to do this? TIA - Nicolas
1
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the...
4
by: Rajendran | last post by:
I want to send mail through PHP using the MS Exchange server. My php.ini file looks like this (for the MAIL functions) ------- ; For Win32 only. SMTP = exchgserver.test.com smtp_port = 25 ;...
2
by: Big Moxy | last post by:
Here is my code for formatting an HTML email. I know that spinning through the $_POST array as I am isn't very pretty but it's a long list so for now I'm using this approach. The problem is that...
6
by: ssankar | last post by:
hi all - I have been tasked to send customized emails to a set of users based on a certain condition in my company. ( This is NOT SPAM ) I have used MIME::Lite successfully to send html...
2
by: lstanikmas | last post by:
Hi, I'm validating a form with this ASP but receiving some blank email responses; does anyone see anything wrong with it?: function isFormVarExcluded(thisForm, strToCheck) { var strExcludeVars...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.