New lines (\r\n) are not working in email body
You need to use a <br>
because your Content-Type
is text/html
.
It works without the Content-Type
header because then your e-mail will be interpreted as plain text. If you really want to use \n
you should use Content-Type: text/plain
but then you'll lose any markup.
Also check out similar question here.
If you are sending HTML email then use <BR> (or <BR />, or </BR>) as stated.
If you are sending a plain text email then use %0D%0A
\r = %0D (Ctrl+M = carriage return)
\n = %0A (Ctrl+A = line feed)
If you have an email link in your email,
EG
<A HREF="mailto?To=...&Body=Line 1%250D%250ALine 2">Send email</A>
Then use %250D%250A
%25 = %