Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

How to insert a carriage return (or line feed) in smtp mail body?

Posted on by 1,085

Hi,

i'm trying to send an email with a list of invoices. 

 

I need to insert a newline for each invoice number. 

I already tried \n and \r , but they don't seem to work. The string actually contains the carriage return, 

but the email body has got now carriage return once sent. 

 

Is there a particular way to do so?

 

Thank you in advance. 

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: How to insert a carriage return (or line feed) in smtp mail body?

    Please create a new thread for your question about how to send e-mails, give it appropriate title and tags and explain your problem there. Please don't change the topic of existing threads. Also notice that this thread has already been answered (years ago).

  • syed baber Profile Picture
    syed baber 11,627 on at
    RE: How to insert a carriage return (or line feed) in smtp mail body?

    Hi Martin,

    That was a different requirement I explained in other thread which is about showing each error message on a separate line in an XML file. There is another requirement which is similar to this, where I need to send the email to specified email address contains error messages and each error message needs to be shown on separate line.

    Can you please let me know which method should I use ? I am using SysEmailSystemTable::sendMail method to send email in AX 2009.

    Thanks,

    Baber.

  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: How to insert a carriage return (or line feed) in smtp mail body?

    I don't think this question was about code, so you likely have a different problem (and what you described in your other thread is about XML, which is something completely different).

    If you're really trying to create emails in code, please create a new thread and explain it there, rather than trying to change the topic of this thread.

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: How to insert a carriage return (or line feed) in smtp mail body?

    It depends on which method you are using to send e-mails, since there are many.

    Some of them are covered in older posts, see here:

    stackoverflow.com/.../dynamics-ax-send-html-file-as-email

  • syed baber Profile Picture
    syed baber 11,627 on at
    RE: AX 2009 - How to insert a carriage return (or line feed) in smtp mail body?

    Hi,

    I have a same requirement. Can you please let me know how and where to set the format as html in code ?

    Thanks,

    Baber.

  • vv1984 Profile Picture
    vv1984 1,085 on at
    Re: AX 2009 - How to insert a carriage return (or line feed) in smtp mail body?

    Thank you,

    it worked like a charm!

  • Suggested answer
    Amiya Das Profile Picture
    Amiya Das 205 on at
    Re: AX 2009 - How to insert a carriage return (or line feed) in smtp mail body?

    Hi,

    try setting email format as html and then instead of \n\r put <br> .

    Regards,

    Amiya

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans