PHP MIME email
| From: | Stephen | Date: | Sat, 26 Apr 2003 15:58:43 +0000 |
| Subject: | PHP MIME email | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-19633@lists.php.net to get a copy of this message | ||
Hi all
I am currently looking into making my site use a single function for sending
a MIME email. What I wanted to achive was a multipart email which would
allow me to send a HTML version AND a plain text version for maximum browser
friendly-ness. No matter how I try, I can not get it to work. Here is an
outline of what I am trying, if someone can see any problems or has any good
advice, it is welcome!
====== PHP Script =====
$Email['Target'] = 'devo@scryt.no-ip.com';
$Email['Headers'] = 'From: "Scryt HC"
<HC@scryt.no-ip.com>'."\n"
.'To: Test Server <test@scryt.no-ip.com>'."\n"
.'Subject: Testing MIME email'."\n"
.'MIME-Version: 1.0'."\n"
.'Content-Type: text/mixed;'."\n"
.'boundary="SCRYT-12345";'."\n"
.'Content-Transfer-Encoding: 7bit'."\n"
.'Please upgrade to a MIME compatible client'."\n"
.'--SCRYT-12345'."\n"
.'Content-Type: text/plain'."\n"
.'Content-Transfer-Encoding: 7bit'."\n"
.'Hello. This is a text email!'."\n"
.'--SCRYT-12345'."\n"
.'Content-Type: text/html'."\n"
.'Content-Transfer-Encoding: 7bit'."\n"
.'<b>Hello</b>. This is a text email!'."\n"
.'--SCRYT-12345--'."\n";
$Email['Subject'] = 'RE: Membership Request';
mail( $Email['Target'], $Email['Subject'], $Email['Message'],
$Email['Headers'] );
=============================
===== Email message recieved =====
Received: from (192.168.0.84 [192.168.0.84]) by MailEnable Inbound Mail
Agent with ESMTP; Sat, 26 Apr 2003 15:55:11 -00:00
Date: Sat, 26 Apr 2003 16:55:19 +0000
Subject: RE: Membership Request
From: "Scryt HC" <HC@scryt.no-ip.com>
To: Test Server <test@scryt.no-ip.com>
Subject: Testing MIME email
MIME-Version: 1.0
Content-Type: text/mixed;
boundary="SCRYT-12345";
Content-Transfer-Encoding: 7bit
Please upgrade to a MIME compatible client
--SCRYT-12345
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello. This is a text email!
--SCRYT-12345
Content-Type: text/html
Content-Transfer-Encoding: 7bit
<b>Hello</b>. This is a text email!
--SCRYT-12345--
=============================
Thanks, Stephen