-1

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?

1 Answers1

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