Sidebar

How do I build carriage returns into an email message in QIE?

0 votes
570 views
asked Oct 25, 2013 by michael-h-5027 (14,350 points)

I am creating a body of text to send out in an email using the sendEmail function and want to include carriage returns.

2 Answers

0 votes
 
Best answer

At the end of each line you should put in <br/> and that will do the bracket return. This only works if the mail receipient is receiving the email in html format.

answered Oct 25, 2013 by michael-h-5027 (14,350 points)
selected Dec 17, 2013 by ron-s-6919
0 votes

In addition to adding <br/> for line feeds/carriage returns, if your email client handles HTML you can use any HTML tags to format your message.  These can include tables, preformatted text, etc.

For example, to put PID-5 in a table:

// Build the top and bottom of the HTML string
var htmlTop = '<html><body><table>';
var htmlBottom = '</table></body></html>';
var tableRows = '';
// Add the table row/table data; this can be in a loop to add multiple table rows
tableRows += '<tr><td>Patient Name:' + '</td><td>' + message.getNode('PID-5') + '</td></tr>';
// Combine the top, the table, and the bottom into one string, which can be emailed
var emailMessage = htmlTop + tableRows + htmlBottom;
// Send the email
qie.sendEmail('email@address', 'Patient List', emailMessage);

 

Here's an example using preformatted text:

// Build the top and bottom of the HTML string
var htmlTop = '<html><body><table>';
var htmlBottom = '</table></body></html>';
// Build the preformatted text
var preformattedText = '<pre>This is line one \n This is line two</pre>';
var emailMessage = htmlTop + preformattedText + htmlBottom;
// Send the email
qie.sendEmail('email@address', 'Patient List', emailMessage);
answered Oct 26, 2021 by jon-t-7005 (7,590 points)
...