I'm trying to send multipart MIME e-mail messages. The message's text is represented as both plain text and HTML (preferred). There may be attachments as well.
The end of my post has a sample header output of my script. This message contains (or should):
A plain text portion
A complimenting HTML portion for clients that support it
Three attachments: a GIF image, a PNG image, and a text file
The plain text and HTML versions are grouped together within an inner boundary as a multipart/alternative.
When I call mail() with these headers under my host's Red Hat Linux PHP setup, I receive the mail flawlessly. It displays the HTML and the three attachments, all of which open.
On Windows, a variety of things will happen depending on the message:
No text at all (my favorite)
Corrupted attachments which frequently contain some other part of the message
Missing attachments
MIME boundaries showing up in the message itself
So my overall questions are:
At a glance, does this message appear to be in the valid format?
Are there any fundamental differences between Windows and Linux versions of mail() that are by design or bugs that are breaking MIME messages?
I have been searching for two days, including this forum. Please do not recommend using a third-party function or class. Thanks, I appreciate any help.
MIME-Version: 1.0
From: "filburt1" <*********>
To: **************
Subject: Tengo attachments-o
Date: Thu, 12 Jan 2006 02:30:52 -0500
Message-ID: <untracked-e44b3e88cae690fa9ceed8c7289da52b@*********>
Content-Type: multipart/mixed; boundary="****-multipart-delimiter-level0-4b7a55505729b7f664e7222960e9c2d5"
Content-Transfer-Encoding: 7bit
Organization: **********
X-Mailer: **************
X-Priority: 5
This message is a multipart MIME message. Please switch to an e-mail client
that supports this format, which the vast majority of modern e-mail
communication uses.
--****-multipart-delimiter-level0-4b7a55505729b7f664e7222960e9c2d5
Content-Type: multipart/alternative; boundary="****-multipart-delimiter-level1-1e59f45f6d7b5e24c95dce83c0a1a8d4"
Content-Transfer-Encoding: 7bit
--****-multipart-delimiter-level1-1e59f45f6d7b5e24c95dce83c0a1a8d4
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
See attached now!
--****-multipart-delimiter-level1-1e59f45f6d7b5e24c95dce83c0a1a8d4
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Tengo attachments-o</title>
</head>
<body id="****-message">
<base href="http://localhost:8082/vb3-****-21/" />
<style type="text/css">
body#****-message, body, html
{
padding: 10px;
margin: 0px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: black;
background-color: white;
}
</style>
See attached <b>now!</b>
</body>
</html>
--****-multipart-delimiter-level1-1e59f45f6d7b5e24c95dce83c0a1a8d4--
--****-multipart-delimiter-level0-4b7a55505729b7f664e7222960e9c2d5
Content-Type: image/gif; name="alsoatwdf.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="alsoatwdf.gif"
R0lGODlhEwAUAPcAAAAAAP///8/Pz+7x+Ofr8+Hk6u3x9+nt8/X3+vHz9rLD2sPS5szW5OPp8bu+
wjdhkz1jklJ4pVR5p1d7p1+Esl+EsGaMumKHs3CZy2uOt2+RuXWWvXqZv4KgxH6avIaixH2VspSt
y5qvyKC1zqu+1a2/1ai5zmJseLfH24iUo7G/0MnW5tvj7XF1era6vwAtYB1FcjxpnEBvpDdgjUJx
...
w48++dxTjzzvxEPPPO8I4A47zqRzTkAAOw==
--****-multipart-delimiter-level0-4b7a55505729b7f664e7222960e9c2d5
Content-Type: image/png; name="icon.png"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="icon.png"
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAK
T2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AU
...
cR5/EmX7iEwet69AqjSKH/hk6BFurGJqvy6Zv3zAHj92AmN0bIz+xDR3+4PtyvFMyrdSgY8vNGkk
edUhv7NBcOOKMs3deWP065++O9seP3YC8eKrF/+Xzn8OAJ1dT0YGLAawAAAAAElFTkSuQmCC
--****-multipart-delimiter-level0-4b7a55505729b7f664e7222960e9c2d5
Content-Type: text/plain; name="IE4 Error Log.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="IE4 Error Log.txt"
TWljcm9zb2Z0IEludGVybmV0IEV4cGxvcmVyIDUuMCBFcnJvciBMb2cgLS0gVkVSX01BSk9SX1BS
T0RVQ1RWRVIuVkVSX01JTk9SX1BST0RVQ1RWRVIuVkVSX1BST0RVQ1RCVUlMRC5WRVJfUFJPRFVD
...
ZGVvcy9GaWxlJTIwVHlwZXMvQVZJcy9OdWRlcyUyMGEnJTIwUG9wcGluJyUyMDclMjBUaGUlMjBD
b250ZXN0JTIwLSUyMDExLmF2aQ0K
--****-multipart-delimiter-level0-4b7a55505729b7f664e7222960e9c2d5--