admin管理员组文章数量:1278690
I have text body in nodemailer. I want to format text in email.
var mailOptions={
to : data.toAddress,
cc : dataAddress,
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.
I have text body in nodemailer. I want to format text in email.
var mailOptions={
to : data.toAddress,
cc : dataAddress,
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.
Share Improve this question asked Jun 7, 2016 at 10:27 Sawan KumarSawan Kumar 3271 gold badge6 silver badges13 bronze badges2 Answers
Reset to default 6You 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.- cc - Comma separated list or an array of recipients email addresses that will appear on the Cc: 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 u want to format text in email you must write this text using HTML syntax eg.
var message = "<p style='font-weight:bold;'> Hi. My name is John </p>";
var mailOptions={
to : data.toAddress,
cc : dataAddress,
bcc : data.bccAddress,
subject : data.subject,
text : message
}
smtpTransport.sendMail(mailOptions, function(error, response){
if(error){
callback(null, error);
}else{
callback(response);
}
});
本文标签: javascriptIn nodemailerHow to format text email BodyStack Overflow
版权声明:本文标题:javascript - In nodemailer, How to format text email Body - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741240680a2363914.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论