I want to send a mail for every new user who registers at my website. For that purpose, I want to have a text with specific words bold and a logo of the company at the end. I'm using Nodemailer (https://nodemailer.com/about/) by fetching a string from a JSON file that will be sent to the new user. But I'm struggling by formatting the text and including the picture. Is there an easy way to do this?
Asked
Active
Viewed 84 times
-1
-
have you seen this code from nodemailer documentation? https://github.com/nodemailer/nodemailer/blob/master/examples/full.js – Murilo Góes de Almeida Jul 23 '20 at 18:15
1 Answers
0
I would create an html template, populate your data in that template, and then feed it to Nodemailer.
Here is a snippet from the Nodemailer site:
let info = await transporter.sendMail({
from: '"Fred Foo " <foo@example.com>', // sender address
to: "bar@example.com, baz@example.com", // list of receivers
subject: "Hello ✔", // Subject line
text: "Hello world?", // plain text body
html: "<b>Hello world?</b>", // html body
});
Also, your image can be embedded in your html as a base 64 string.

John
- 36
- 3