Hi, on windows xp I'm using
xampp v 1.6.4
I'm trying to send mail. The mail always sends, but the multipart
sections are broken. Essentially, I want to send an html email that
has a link it, like http://www.google.com so the reader can click on
the link.
When I get the email, the body is empty.
It seems that No matter what I can't get multiple newlines before the
boundry sections.
I've tried just \n, just \r, \r\n, \r\n\r\n, \n\n and more
variations....
Perhaps the problem isn't the newlines?
I had some code that worked on linux, but I've never got it to work on
windows.
The code and email follow.
Can anyone tell me how to get this working?
Thanks
// Code Start
<?php
define("CRLF", chr(0x0D) . chr(0x0A));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<?php
$body = "From: chupper@localho st" . CRLF .
"MIME-Version: 1.0" . CRLF .
"Content-Type: multipart/alternative; " . CRLF .
" boundary=\"----=_Part_15337_82 53480.119725027 5132\"" . CRLF .
"------=_Part_15337_82 53480.119725027 5132" . CRLF .
"Content-Type: text/plain; charset=ISO-8859-1" . CRLF .
"Content-Transfer-Encoding: 7bit" . CRLF .
"Content-Disposition: inline" . CRLF . CRLF .
">" . CRLF .
"http://http://www.google.com" . CRLF .
">" . CRLF . CRLF .
"------=_Part_15337_82 53480.119725027 5132" . CRLF .
"Content-Type: text/html; charset=ISO-8859-1" . CRLF .
"Content-Transfer-Encoding: 7bit" . CRLF .
"Content-Disposition: inline" . CRLF . CRLF .
"<a href=\"http://http://www.google.com\ "><h4>some stuff</h4></a>" .
CRLF . CRLF .
"------=_Part_15337_82 53480.119725027 5132--";
mail( "chupper@localh ost", "Some subject", NULL, $body );
?>
<hr>
<textarea name="debug" rows="20" cols="80" id="id_debug" ><?php echo
$body ?></textarea>
</body>
</html>
// Code End
I get the message with outlook express
// Message Start
Received: from spooler by localhost (Mercury/32 v4.01b); 10 Dec 2007
17:28:07 -0500
X-Envelope-To: <chupper@localh ost>
Return-path: <chupper@localh ost>
Received: from CLIFF (127.0.0.1) by localhost (Mercury/32 v4.01b) ID
MG000033;
10 Dec 2007 17:28:03 -0500
Date: Mon, 10 Dec 2007 17:28:03 -0500
Subject: Some subject
To: chupper@localho st
From: chupper@localho st
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_15337_82 53480.119725027 5132"
------=_Part_15337_82 53480.119725027 5132
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline------=_Part_15337_82 53480.119725027 5132
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<a href="http://http://www.google.com" ><h4>some stuff</h4></a>
------=_Part_15337_82 53480.119725027 5132--
// Message End
xampp v 1.6.4
I'm trying to send mail. The mail always sends, but the multipart
sections are broken. Essentially, I want to send an html email that
has a link it, like http://www.google.com so the reader can click on
the link.
When I get the email, the body is empty.
It seems that No matter what I can't get multiple newlines before the
boundry sections.
I've tried just \n, just \r, \r\n, \r\n\r\n, \n\n and more
variations....
Perhaps the problem isn't the newlines?
I had some code that worked on linux, but I've never got it to work on
windows.
The code and email follow.
Can anyone tell me how to get this working?
Thanks
// Code Start
<?php
define("CRLF", chr(0x0D) . chr(0x0A));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<?php
$body = "From: chupper@localho st" . CRLF .
"MIME-Version: 1.0" . CRLF .
"Content-Type: multipart/alternative; " . CRLF .
" boundary=\"----=_Part_15337_82 53480.119725027 5132\"" . CRLF .
"------=_Part_15337_82 53480.119725027 5132" . CRLF .
"Content-Type: text/plain; charset=ISO-8859-1" . CRLF .
"Content-Transfer-Encoding: 7bit" . CRLF .
"Content-Disposition: inline" . CRLF . CRLF .
">" . CRLF .
"http://http://www.google.com" . CRLF .
">" . CRLF . CRLF .
"------=_Part_15337_82 53480.119725027 5132" . CRLF .
"Content-Type: text/html; charset=ISO-8859-1" . CRLF .
"Content-Transfer-Encoding: 7bit" . CRLF .
"Content-Disposition: inline" . CRLF . CRLF .
"<a href=\"http://http://www.google.com\ "><h4>some stuff</h4></a>" .
CRLF . CRLF .
"------=_Part_15337_82 53480.119725027 5132--";
mail( "chupper@localh ost", "Some subject", NULL, $body );
?>
<hr>
<textarea name="debug" rows="20" cols="80" id="id_debug" ><?php echo
$body ?></textarea>
</body>
</html>
// Code End
I get the message with outlook express
// Message Start
Received: from spooler by localhost (Mercury/32 v4.01b); 10 Dec 2007
17:28:07 -0500
X-Envelope-To: <chupper@localh ost>
Return-path: <chupper@localh ost>
Received: from CLIFF (127.0.0.1) by localhost (Mercury/32 v4.01b) ID
MG000033;
10 Dec 2007 17:28:03 -0500
Date: Mon, 10 Dec 2007 17:28:03 -0500
Subject: Some subject
To: chupper@localho st
From: chupper@localho st
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_15337_82 53480.119725027 5132"
------=_Part_15337_82 53480.119725027 5132
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline------=_Part_15337_82 53480.119725027 5132
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
<a href="http://http://www.google.com" ><h4>some stuff</h4></a>
------=_Part_15337_82 53480.119725027 5132--
// Message End
Comment