I have a textarea saving to a database that I’m using to send as the body of an email.
I allow tokens to be used as placeholders for information pertaining to that message.
If I don’t touch the placeholders at all the email sends just fine with the line breaks exactly as they are in the textbox (the email is being sent in plain text).
However, when I start using the replace function, the new line characters start disappearing and all the lines get pushed together.
For example.
Body.Replace("%procedure%", CurrentOrder.Description);
Will replace the text %procedure%, but will also remove the newline at the end of the line. Even if the newline isn’t directly after the text being replaced.
Any ideas?
edit:
For now, I’m just replacing “\n” with “<br />” and sending the email as HTML. I would rather keep it as plain text as I don’t have control over the recipients at all.
EDIT 2: It appears to be an issue with outlook itself, not the email. I just viewed the exact same email in gmail, and the format was correct.
Outlook removes new lines unless the line ends with two spaces.
If you’re testing the emails to an account that uses Outlook try adding two spaces before your new lines and see if that fixes it.