Codeunit 397: Mail - AddBodyLine

Torben_R.Torben_R. Member Posts: 99
edited 2014-03-26 in NAV Three Tier
I have a function that create emails and in the function I call the function AddBodyLine in codeunit 397 (Mail). I pass a textline, CR and LF.

In NAV 2009 it works perfectly, but in NAV 2013 the CR LF is ignored and I get a mailbody with one very long line.

If I use the function AppendBody in codeunit 400 (SMTP Mail) it works perfectly in both NAV 2009 and NAV 2013.

Can anyone tell me how to pass the CR LF to codeunit 397 in NAV 2013?
Name	DataType	Subtype	Length
SMTPMail	Codeunit	SMTP Mail	
Mail	Codeunit	Mail	
MailClient	Option		
CR	Char		
LF	Char		
CRLF	Text		2

CR := 13;
LF := 10;
CRLF := FORMAT(CR) + FORMAT(LF);

...

      IF MailClient = MailClient::SMTP THEN
        SMTPMail.AppendBody(Text + CRLF)
      ELSE
        Mail.AddBodyline(Text + CRLF);

Comments

  • ppavukppavuk Member Posts: 334
    you could use a html email body. something like <P> your text here <BR> another line </P>

    BR would give you a line break.
  • ppavukppavuk Member Posts: 334
    Actually, I might be misguided you. In codeunit 357 there is weird BSTR converter


    BSTRConverterBody.AppendNextStringPortion(TextLine);

    have no idea how it works, but apparently it is something what messing with your CRLF
  • ppavukppavuk Member Posts: 334
    maybe this one old post will help you: http://www.mibuso.com/forum/viewtopic.php?t=5496
  • ayansinhaayansinha Member Posts: 3
    I did it this way:


    MailCD.AddBodyline('Text1');
    MailCD.AddBodyline(FORMAT('<br>'));
    MailCD.AddBodyline('Text2');
    MailCD.AddBodyline(FORMAT('<br>'));
    MailCD.AddBodyline('Text3');
    MailCD.AddBodyline(FORMAT('<br>'));
    MailCD.AddBodyline('Text4');

    works like a charm with HTML format TRUE.

    I think rest of the HTML tags can also be used like this.
  • tinoruijstinoruijs Member Posts: 1,226
    Experiencing the same problem in NAV 2013 R2 latest build 36281.
    I'm curious Torben if and how you solved the problem?

    Gonna try the suggestions with BR now.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • ShedmanShedman Member Posts: 194
    I faced the same problem a while ago, see this topic.

    Double checked my code; I only use Char = 10 as LineBreak character.
  • tinoruijstinoruijs Member Posts: 1,226
    Shedman wrote:
    I faced the same problem a while ago, see this topic.

    Double checked my code; I only use Char = 10 as LineBreak character.

    Thank you very much! Got it working again. =D>

    Tino Ruijs
    Microsoft Dynamics NAV specialist
Sign In or Register to comment.