I am using PHP mail()
function:
$to = 'AAAA <[email protected]>';
$subject = 'BBBB';
$message = "CCCC\r\nCCCC CCCC \r CCC \n CCC \r\n CCC \n\r CCCC";
$headers = 'From: DDD<[email protected]>' . "\r\n";
$headers .= "Content-Type: text/html; charset=\"UTF-8\"; format=flowed \r\n";
$headers .= "Mime-Version: 1.0 \r\n";
$headers .= "Content-Transfer-Encoding: quoted-printable \r\n";
mail($to, $subject, $message, $headers);
When I receive this email it looks like this:
CCCC CCCC CCCC CCC CCC CCC CCCC
I would expect something like this:
CCCC
CCCC CCCC CCC
CCC
CCC
CCCC
It works fine without Content-Type
HTTP header. How can I make new lines and still use my "Content-Type" declaration?
In your Send Outlook Mail Message activity you have selected the IsBodyHtml in the property as True, so you can use "<br />" tag where you need NewLine. This is a html tag for a new line.
By default, the Auto Remove Line Breaks feature in Outlook is enabled. This causes the line breaks to be removed. Any two or more successive line breaks are not removed.
You can insert a break into plaintext emails using {! BR()} .
Reason. By default, the Remove extra line breaks in plain text messages option is enabled in Outlook. So, if a line break is found, it is removed (but, if there are two or more successive line breaks, they are not removed).
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 = %
You need to use <br>
instead of \r\n
. For this you can use built in function call nl2br
So your code should be like this
$message = nl2br("CCCC\r\nCCCC CCCC \r CCC \n CCC \r\n CCC \n\r CCCC");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With