Tuesday, June 4, 2019

Send Email with Body HTML Unformatted Content

When using nlapiSendEmail(author, recipient, subject, body, cc, bcc, records, attachments, notifySenderOnBounce, internalOnly, replyTo) function, the body parameter is formatted with HTML tags. This may be not desired in case of a user needs to keep the same body content as on input (non-HTML formatted).The solution to pass the body content unformatted is to send it as an attachment (one of the parameters of the nlapiSendEmail() function);

Example:A user needs to pass XML content to email client, where the XML is processed.

var xml = "";// XML Headerxml += '';xml += '';// Header xml += ''; xml += '  Date Created '; xml += '  Name '; xml += '  Phone '; xml += '  Fax '; xml += '  Email address '; xml += '';// Contents xml += '';xml += ' 10/10/2013';xml += ' Sample Record';xml += ' 123456789';xml += ' 123456799';xml += ' sample@sample.com';xml += '';// Close documentxml += '';// Create File Attachment var file = nlapiCreateFile('searchresults.xml', 'XMLDOC', xml);// Send the XML file via emailvar newEmail = nlapiSendEmail(-5, 'admin@sample.com', 'Sample XML Email','Please see the attached file', null, null, null, file);


  1. Excellent article plus its information and I positively bookmark to this site because here I always get an amazing knowledge as I expect. Thanks for this to share with us Content creation

  2. This comment has been removed by a blog administrator.