Nodemailer
Send emails through Sendfully's SMTP server using Nodemailer in Node.js.
Use Nodemailer to send emails through Sendfully's SMTP server.
Setup
Before you start, make sure you have:
- An API key with sending access
- A verified sending domain
Install Nodemailer:
npm install nodemailerCreate a transport
Configure Nodemailer to connect to Sendfully's SMTP server:
const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({ host: "smtp.sendfully.com", port: 465, secure: true, auth: { user: "sendfully", pass: process.env.SENDFULLY_API_KEY, },});Send an email
await transporter.sendMail({ from: "Your App <notifications@mail.yourdomain.com>", to: "recipient@example.com", subject: "Your password reset link", html: "<p>Click <a href='https://example.com/reset?token=abc'>here</a> to reset your password.</p>",});The from address must use a domain you've verified in Sendfully.
Send with attachments
await transporter.sendMail({ from: "Your App <notifications@mail.yourdomain.com>", to: "recipient@example.com", subject: "Your invoice", html: "<p>Your invoice is attached.</p>", attachments: [ { filename: "invoice.pdf", path: "./invoices/invoice-1234.pdf", }, ],});What's next?
- SMTP overview - connection details, limits, and error codes
- Python with smtplib - send emails using Python's standard library
