nodemailer


1. Sending HTML Emails

const nodemailer = require("nodemailer");

// create reusable transporter object using SMTP transport
const transporter = nodemailer.createTransport({
  host: "smtp.ethereal.email",
  port: 587,
  secure: false, // true for 465, false for other ports
  auth: {
    user: "hjembir.pagac@ethereal.email", // generated ethereal user
    pass: "KSMN5WY2989rK2gfnf", // generated ethereal password
  },
});

// setup email data with HTML content
const mailOptions = {
  from: '"John Doe" <john.doe@example.com>', // sender address
  to: "recipient@example.com", // list of receivers
  subject: "Hello from Nodemailer", // Subject line
  html: "<h1>Hello, world!</h1>", // html body
};

// send mail with defined transport object
transporter.sendMail(mailOptions, (error, info) => {
  if (error) {
    console.log(error);
  } else {
    console.log("Message sent: %s", info.messageId);
  }
});

2. Sending Text-Only Emails

3. Sending Emails with Attachments

4. Sending Emails with Inline Images

5. Sending Emails with Multiple Recipients

6. Using a Custom SMTP Server

7. Using OAuth2

8. Sending Emails through Sendgrid

9. Sending Emails through Mailgun

10. Sending Emails through Amazon SES

11. Verifying SMTP Connection

12. Sending Confirmation Emails

13. Sending Reset Password Emails

14. Sending Transactional Emails

15. Sending Email Campaigns

16. Using Custom Transporters

17. Using a Queue

18. Using a Scheduler

19. Sending Emails with Multiple Transports

20. Using a Proxy

21. Using a VPN

22. Sending Emails from a Docker Container

23. Using a Command-Line Interface (CLI)

24. Sending Emails with DKIM

25. Sending Emails with SPF