Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
using html template with firebase functions nodemailer

I want to send an email to users with nodemailer. I have an html template but I cannot use it. Template html file is under functions folder (same folder with index.js) What should I write in html section for nodemailer?

const mailOptions = {
    from: `blabla@blabla.com`,
    to: snap.data().email,
    subject: 'blablabla welcome',
    html: '', // ???
  };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As stated in the message configuration:

The following are the possible fields of an email message:

  • from - The email address of the sender. All email addresses can be plain ‘sender@server.com’ or formatted '“Sender Name” sender@server.com', see Address object for details
  • to - Comma separated list or an array of recipients email addresses that will appear on the To: 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://…'})
var message = {
  from: "sender@server.com",
  to: "receiver@sender.com",
  subject: "Message title",
  text:  "Plaintext version of the message",
  html: "<p>HTML version of the message</p>"
};

In short, those are the most common values used to send an email message. The html field is used to put the body of the message using HTML to format it. If you only want to send it in plaintext (without formatting) or to provide fallback support to devices with plaintext support only, you can use the text field alongside or instead of html field.

See also

  • Nodemailer 2.x
  • Cloud Functions for Firebase, sending email
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!