...

View Full Version : Resolved Message getting cut off....



dniwebdesign
11-12-2010, 06:18 PM
I have the function
function sendHTMLemail($HTML,$from,$to,$subject) {


// First we have to build our email headers
// Set out "from" address
$headers = "From: noreply@example.net\r\n";

$boundary = md5(time());


// First we be nice and send a non-html version of our email
$headers .= "Content-Type: multipart/alternative;".
"boundary = $boundary\r\n";

$headers .= "This is a MIME encoded message.\r\n";

//Text Version
$headers .= "\n--$boundary\n".
"Content-Type: text/plain; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n";

$headers .= chunk_split(base64_encode(strip_tags($HTML)));

// Now we attach the HTML version
$headers .= "\n--$boundary\n".
"Content-Type: text/html; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n";

$headers .= chunk_split(base64_encode($HTML));

// And then send the email ....
$doit1 = mail($to,$subject,"",$headers);
echo $doit1 ? "<strong>Mail sent1</strong>" : "Mail failed1";
return $doit;
}which now due to my host, works. :) To a point. The message I pass into the function to be send starts out:
$message = "<span style='font-family: Verdana, Geneva, sans-serif; font-size: 12px;'>Adrenaline Junkies Online Store<br />
----------------------------------------<br />
Hello ".$_POST["full_name"].",<br />

Either you or someone pretending to be you registered an account at our online store at http://store.example.net. If this
was you we ask that you please confirm the request by visiting the activation link below. Just click on the link or copy and paste it
into your browser.
<p />";
//Actually longer I just cut it out for this posts sake. :)

However in the E-mail I get something like:

enaline Junkies Online Store
----------------------------------------
Hello Dawson Willie,
Either you or someone pretending to be you registered an account at our online store at http://store.example.net. If this was you we ask that you please confirm the request by visiting the activation link below. Just click on the link or copy and paste it into your browser.
Can anyone else see why my message is being cut off at the beginning?

BIOSTALL
11-12-2010, 07:11 PM
You're currently using a mixture of \n and \r\n. I wonder what happens if you make all of these \r\n?

Might not make a difference but I've known new line characters to break multipart emails before.

dniwebdesign
11-12-2010, 07:39 PM
Yea, it was the \r\n. Not enough in some places, too many in others. :\ Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum