I have text body in nodemailer. I want to format text in email.
var mailOptions={
to : data.toAddress,
cc : data.ccAddress,
bcc : data.bccAddress,
subject : data.subject,
text : data.message
}
smtpTransport.sendMail(mailOptions, function(error, response){
if(error){
callback(null, error);
}else{
callback(response);
}
});
For eg; inculde bullet style, bold specific word.
But in documentation I am not finding specific section.
Kindly let me know if any one has any idea on this.
Before we start sending email, the first step is to configure an SMTP transport. A transport is the term Nodemailer uses to describe the method it will use to actually send your email. import nodemailer from 'nodemailer'; const smtp = nodemailer. createTransport({ host: '', port: 587, secure: process.
NodeMailer is the most famous module used for sending and receiving emails from NodeJS applications. It is a zero dependency module for your NodeJS apps. You can easily send emails as plain text, HTML, or attachments (image, document, etc.).
You need to configure a transporter with your custom domain info (host, port, user and password) You can find this info in the email configuration of your specific hosting provider. Hi there! I get the message 'email sent' and the function finishes with the status 'ok'.
First, open a connection to the email server using a protocol (SMTP, IMAP, POP) to read email(s) from the email service. The email service can be Gmail, yahoo, outlook. e.t.c. This tutorial uses Imap to read emails and will be using two packages to get the magic started.
You just to add html:
const message = {
from: "[email protected]",
to: "[email protected]",
subject: "Message title",
text: "Plaintext version of the message",
html: "<p>HTML version of the message</p>"
};
from - The email address of the sender. All email addresses can be plain ‘[email protected]’ or formatted ’“Sender Name” [email protected]‘, see Address object for details.
to - Comma separated list or an array of recipients email addresses
that will appear on the To: field.
bcc - Comma separated list or an array of recipients 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 (see Using attachments
for details). Attachments can be used for embedding images as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With