Re: [PHP-DB] Re: Breaking up new lines for e-mail
on 1/7/03 7:41 PM, Gavin Amm at [EMAIL PROTECTED] appended the following bits to my mbox: > For example, they might type in the following (between the dashed > lines): > -- > Hi, > > Please send me some info. > > Thanks, > Gav > -- > > When I receive the mail, however, it looks like this: > -- > Hi, Please send me some info. Thanks, Gav > -- > > This is fine for such a short message, but lengthy messages would be > horrid to read if all the line breaks were taken out... This probably should be on PHP-General, since it isn't related to databases. That said and not having seen the code, I'm wondering if the user may be submitting the form from a Macintosh computer which uses carriage returns as end of line characters. If that were the case, they might not show up in a windows email client as line breaks. You might want to convert all line breaks to Windows style CRLF, that is "\r\n". It may be that CRLF is required by one of the email RFCs. Something like: $text = str_replace("\r\n","\n",$text); // windows to unix $text = str_replace("\r","\n",$text); // mac to unix $text = str_replace("\n","\r\n",$text); // all to windows HTH. Sincerely, Paul Burney -- I'm inhaling Caesar's last gasp... http://paul.burney.ws/thoughts/caesars_breath.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Breaking up new lines for e-mail
Hello, On 01/07/2003 10:41 PM, Gavin Amm wrote: Thanks for your reply. Word wrap seems to be ok. What does seem to be a problem is the line breaks... For example, they might type in the following (between the dashed lines): -- Hi, Please send me some info. Thanks, Gav -- When I receive the mail, however, it looks like this: -- Hi, Please send me some info. Thanks, Gav -- This is fine for such a short message, but lengthy messages would be horrid to read if all the line breaks were taken out... That is not the correct behaviour of wordwrap(). As I said, wordwrap() is broken in some PHP versions and that is why I use my class function WrapText() instead of wordwrap(). Of course I use my class for more than just wrapping text as it is mostly meant to compose and send properly formatted e-mail messages, some in HTML with alternative text parts, embedded images in HTML, attachments, etc.. If you do not need all that, you may just take out the WrapText function and use it separately as it does not need the rest of the class functions. Regards, Manuel Lemos -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 8 January 2003 11:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Breaking up new lines for e-mail Hello, On 01/07/2003 10:11 PM, Gavin Amm wrote: Would someone mind pointing me to a function, or some code, or give me a seudo-code start for the following: I'm using the mail() function. If someone submits the form with text in the multi-line textarea, any carrige returns (ie, by pressing ENTER) are taken out & the body is sent as a single line. I'm sending the e-mail in plain text. There is wordwrap() but that function is broken in several PHP versions and even had a buffer overflow security problem, so I gave up on using it at all. What I use is a function that is part of a message composing and sending class that basically does the same as wordwrap except that it works well in all PHP versions without any security problems. Check out the function WrapText() of the email_message_class here: http://www.phpclasses.org/mimemessage -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Breaking up new lines for e-mail
Thanks for your reply. Word wrap seems to be ok. What does seem to be a problem is the line breaks... For example, they might type in the following (between the dashed lines): -- Hi, Please send me some info. Thanks, Gav -- When I receive the mail, however, it looks like this: -- Hi, Please send me some info. Thanks, Gav -- This is fine for such a short message, but lengthy messages would be horrid to read if all the line breaks were taken out... Cheers, Gav -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 8 January 2003 11:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Breaking up new lines for e-mail Hello, On 01/07/2003 10:11 PM, Gavin Amm wrote: > Would someone mind pointing me to a function, or some code, or give me > a seudo-code start for the following: > > I'm using the mail() function. > If someone submits the form with text in the multi-line textarea, any > carrige returns (ie, by pressing ENTER) are taken out & the body is > sent as a single line. I'm sending the e-mail in plain text. There is wordwrap() but that function is broken in several PHP versions and even had a buffer overflow security problem, so I gave up on using it at all. What I use is a function that is part of a message composing and sending class that basically does the same as wordwrap except that it works well in all PHP versions without any security problems. Check out the function WrapText() of the email_message_class here: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Breaking up new lines for e-mail
Hello, On 01/07/2003 10:11 PM, Gavin Amm wrote: Would someone mind pointing me to a function, or some code, or give me a seudo-code start for the following: I'm using the mail() function. If someone submits the form with text in the multi-line textarea, any carrige returns (ie, by pressing ENTER) are taken out & the body is sent as a single line. I'm sending the e-mail in plain text. There is wordwrap() but that function is broken in several PHP versions and even had a buffer overflow security problem, so I gave up on using it at all. What I use is a function that is part of a message composing and sending class that basically does the same as wordwrap except that it works well in all PHP versions without any security problems. Check out the function WrapText() of the email_message_class here: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php