New line characters not getting reflected properly

35 Views Asked by At

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.

1

There are 1 best solutions below

0
Pearl On BEST ANSWER

This worked

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