Re: save email in original layout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



http://php.net/mysql_real_escape_string is the only thing you need to
worry about as far as MySQL is concerned.

Translating from Email newlines to HTML newlines to OS newlines is
another kettle of fish...

Email newlines are SUPPOSED to be \n, except that some ancient Windows
MTAs insisted on using \r\n and...

So I'm concerned to see the \r in the emails, as they shouldn't be
there...

And, of course, if you display this to a browser, you would need
something like:
echo nl2br(htmlentities($email));
to give the appearance of line-breaks in HTML.

To send it back out as email, with a real MTA, you'll probably need to
replace the \r\n with \n, though the real MTA might even be smart
enough to do that, knowing that it came from a broken MTA in the first
place.

Did I just confuse email headers (\n only) with the body (\r\n) again?
 I do that all the time...  Experimentation or reading RFCs will
straighten you out on this one, though you're always at the mercy of
the MTAs involved, which may or may not be doing it right...

You also might as well prepare now for the Outlook users who will
insist on using ASCII control characters for things like quote marks
because they want those curly quotes that DO NOT WORK for anybody
other than MS users... There's several solutions at http://str_replace
for that one.

On Wed, February 21, 2007 12:11 am, Richard Kurth wrote:
> I need to save  an email in a mysql database so that it retains it's
> original layout
> so the example below
>
>    Hello ,
>
>   Do you dream of a better life?  Do you wish you had financial
> stability
> and freedom?  Would you like to be your own boss?
>
> would look like this when the file is saved
>
> \r\n Hello ,\r\n\r\n\r\n  Do you dream of a better life?  Do you wish
> you
> had financial stability and freedom?  Would you like to be your own
> boss?
>
> how do I insert all the line spaces like above
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux