Search code examples
outlookoffice-jsoutlook-addinoffice-addinsoutlook-restapi

New line characters not getting reflected properly


I am extracting the subject, sender and the body of a mail and sharing these to another application using outlook add-in. The payload looks like this:

var payload = 'Subject: ' + '\n'  + subject + '\n' +
            'Sender: ' + '\n'  + sender + '\n' +
            'Body: ' + '\n' + bodyContent + '\n' +
            'Additional Message: ' + '\n' + addMsg;

but the new line characters are not getting reflected properly. It is all in the same line.


Solution

  • This worked

    var payload = `Subject:\n${subject}\n\nSender:\n${sender}\n\nBody:\n${bodyContent}\n\nAdditional Message:\n${addMsg}`;