Newline showing up on screen but not in email
If your email is HTML formatted then that would affect presentation of newlines.
Two things I would try:
try with CRLF (
"\r\n"
) instead of just LFmake sure your email is not being sent in HTML mode, or, if yes, try replacing the
"\n"
with"<br>"
Are you reading the e-mail in Outlook? Outlook will strip "extra line breaks" (that is, those line breaks it deems unnecessary by some arcane rule) from plain text mail. To get around this, I convert mail such as logs to HTML before sending it. This is very simple; just wrap it in <PRE>... </PRE> tags (with appropriate HTML headers of course).