Home > Software engineering >  How to send emails with nodemailer and dreamhost (on Node.js server)
How to send emails with nodemailer and dreamhost (on Node.js server)

Time:10-10

I can't find any helpful posts specific to sending emails from dreamhost using nodemailer. I did find a dreamhost article for sending emails via PHP so maybe that can help point us in the right direction...

Either way here's my mailer.ts file:

import { createTransport, getTestMessageUrl } from "nodemailer";

import { frontendURL } from "./urls";

var transport = createTransport({
  host: "smtp.dreamhost.com",
  port: 465,
  auth: {
    user: encodeURIComponent(process.env.PROD_MAIL_USER),
    pass: encodeURIComponent(process.env.PROD_MAIL_PASS),
  },
  secure: true,
});

function generateHTML(resetToken: string) {
    return `
      <div>
        <h2>Hello from HaBits            
  • Related