web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

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

(0) ShareShare
ReportReport
Posted on by 1,087

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

I have the same question (0)
  • Martin Dráb Profile Picture
    235,928 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
    11,633 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
    235,928 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
    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
    11,633 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
    1,087 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
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans