473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 3172
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.