Question
· Aug 28, 2017

How to add a new line in email?

Hi, folks!

I'm sending emails with %Net.MailMessage.

How can I add a new line for the email body?

The code is:

dim msg as %Net.MailMessage = ##class(%Net.MailMessage).%New()
set msg.Charset="UTF-8"
do msg.TextData.Write("Dear  "_Username)
do msg.TextData.Write("Line1")
do msg.TextData.Write("Line2")
And I'm getting in email:
Dear UserLine1Line2

How can I get:

Dear User

Line1

Line2
Discussion (8)2
Log in or sign up to continue

my quick test says there are two chars, CR and LF, on an AIX and on Ubuntu

USER>s str=##class(%GlobalCharacterStream).%New()
USER>d str.WriteLine("Test")
USER>d str.Rewind()
USER>zzdump str.Read(100)
0000: 54 65 73 74 0D 0A                                       Test..
USER>
​USER>w $zv
Cache for UNIX (IBM AIX for System Power System-64) 2017.1 (Build 792U) Mon Mar 20 2017 19:19:37 EDT
USER>

-----------------

USER>s str=##class(%GlobalCharacterStream).%New()
USER>d str.WriteLine("Test")
USER>d str.Rewind()
USER>zzdump str.Read(100)
0000: 54 65 73 74 0D 0A                                       Test..
USER>
​USER>w $zv
Cache for UNIX (Ubuntu Server LTS for x86-64) 2017.1 (Build 792U) Mon Mar 20 2017 19:22:31 EDT
USER>

Maybe, your problem has nothing to do with Cache?

Regards,

Julius