Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Mail function breaking message
- Michael Satterwhite
February 5, 2005, 11:02 pm
rate this thread
message body as plain text and tested it by writing it to a file and
examining the file. It's being built correctly.
When I send it through mail by a command similar to:
mail($to, 'Survey Results', $msgBody, "From: firstname.lastname@example.org");
the message gets broken up. At periodic places in the file, I seea
"!" (without the quotes) being inserted and the text format is broken.
The only thing I can think of is some type of length restriction. The
message isn't super long, but it isn't short either.
Can anyone offer any help?
Re: Mail function breaking message
I suspect the length of the individual lines in your message body, not the
message as a whole, is causing the problem. I believe lines longer than a
certain number of characters are truncated and an exclamation mark placed
at the end of the line. This happened to me once using the built-in mail
function with sendmail on a Linux box.
Since you say your message is plain text, try running it through wordwrap:
mail($to, 'Survey Results', wordwrap($msgBody), "From: email@example.com");
This splits the string on word boundaries so that each line is not longer
than 75 characters (by default).
- » Problem creating a mysql database named M#2 using php
- — Previous thread in » PHP Scripting Forum