pjs.sendEmail()
To use this, you'll need to install the nodemailer NPM package into your Profound.js instance directory. For more information on this NPM package, see the following page: https://www.npmjs.com/package/nodemailer.
This API sends an email. The NodeMailer SMTP transport details must be specified under the mailTransport configuration property, which can be stored in your Profound.js config.js file or your workspace .noderun/settings.json file.
Parameter
Email data object containing the following properties:
from - The email address of the sender. All email addresses can be plain ‘sender@server.com’ or formatted '“Sender Name” sender@server.com’.
to - Comma separated list or an array of recipient email addresses that will appear on the To: field
cc - Comma separated list or an array of recipient email addresses that will appear on the Cc: field
bcc - Comma separated list or an array of recipient email addresses that will appear on the Bcc: field
subject - The subject of the email
text - The plaintext version of the message as an Unicode string, Buffer, Stream or an attachment-like object ({path: ‘/var/data/…'})
html - The HTML version of the message as an Unicode string, Buffer, Stream or an attachment-like object ({path: ‘http://…'})
attachments - An array of attachment objects. Attachments can be used for embedding images as well.
For additional properties and other details, refer to the nodemailer npm package documentation.
Return value
Information object providing the result from the transport. It may include various properties, such as the messageId. The exact format depends on the transport mechanism used.
Example
pjs.sendEmail({
from: 'Nodemailer <example@nodemailer.com>',
to: 'Nodemailer <example@nodemailer.com>',
subject: 'Test Email Message',
text: 'For clients with plaintext support only',
html: `<h1>Thank you for placing your order.</h1>
Your order number is ${ordNum}.`
});