nodemailer
nodemailer enables Node.js developers to dispatch transactional emails programmatically with straightforward configuration and robust delivery handling. Whether you're sending password resets, order confirmations, or notifications, this skill integrates email functionality directly into your application workflow.
nodemailer enables you to send transactional emails from a Node.js application by creating a transporter object configured with your email service credentials (SMTP or OAuth2), then calling the sendMail() method with recipient, subject, and body details. The skill handles the entire delivery pipeline, from authentication through message transmission, making it straightforward to integrate email functionality into your application workflow for password resets, order confirmations, and notifications.
AI-generated summary based on this skill's SKILL.md
Install
AIDotNet/MoYuCode/nodemailer · repository language: TypeScript
git clone https://github.com/AIDotNet/MoYuCode
cp -r MoYuCode/skills/tools/nodemailer ~/.claude/skills/nodemailerFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I send emails from Node.js using nodemailer?
nodemailer enables you to send transactional emails from a Node.js application by creating a transporter object configured with your email service credentials (SMTP or OAuth2), then calling the sendMail() method with recipient, subject, and body details. The skill handles the entire delivery pipeline, from authentication through message transmission, making it straightforward to integrate email functionality into your application workflow for password resets, order confirmations, and notifications.
What authentication methods does nodemailer support for email delivery?
nodemailer supports multiple authentication approaches for email delivery, including traditional SMTP with username and password, as well as OAuth2 for services like Gmail. You configure the authentication method when setting up your transporter, specifying credentials or OAuth tokens depending on your email provider's requirements. This flexibility allows nodemailer to work with virtually any email service while maintaining security best practices.
Can nodemailer send email with attachments in Node.js?
Yes, nodemailer fully supports sending emails with file attachments in Node.js. When composing your email message, you simply add an attachments array specifying the file paths or buffer contents you want to include. nodemailer handles encoding and MIME type detection automatically, making it easy to attach documents, invoices, or other files to your transactional emails without additional configuration.
How can I build HTML email templates with styling and embedded content using nodemailer?
nodemailer enables you to construct HTML email templates by setting the html property of your message object instead of plain text. You can include inline CSS styling, embedded images, and formatted content directly in the HTML. For embedded images, nodemailer supports the cid: protocol to reference images by identifier, allowing you to embed images in outgoing emails without external URLs, ensuring reliable display across email clients.
What is the nodemailer setup process for Gmail with OAuth2?
nodemailer with Gmail requires configuring OAuth2 credentials through Google's developer console to obtain a client ID, client secret, and refresh token. You then create a transporter with the service set to 'gmail' and provide your OAuth2 credentials in the auth object. This approach is more secure than storing your Gmail password directly and is the recommended method for integrating nodemailer with Gmail for reliable transactional email delivery.
Does nodemailer support email queuing and rate limiting for bulk sends?
nodemailer itself provides the core email-sending functionality, and while it doesn't include built-in queuing or rate limiting, the skill's architecture allows you to implement these patterns in your application layer. You can combine nodemailer with job queues or custom throttling logic to manage bulk email sends responsibly, ensuring compliance with email service provider limits and maintaining application performance when dispatching large volumes of transactional emails.
SKILL.md
rendered from the published skill — quoted content, verbatim
Nodemailer Tool
Description
Send emails from Node.js with SMTP, OAuth2, attachments, and HTML templates.
Source
- Repository: nodemailer/nodemailer
- License: MIT
Installation
npm install nodemailer
Usage Examples
Basic Email
import nodemailer from 'nodemailer';
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 587,
secure: false,
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASS,
},
});
async function sendEmail() {
const info = await transporter.sendMail({
from: '"My App" <noreply@myapp.com>',
to: 'user@example.com',
subject: 'Welcome to My App',
text: 'Hello, welcome to our platform!',
html: '<h1>Hello</h1><p>Welcome to our platform!</p>',
});
console.log('Message sent:', info.messageId);
}
HTML Email with Template
```typescript async function
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
skills/tools/nodemailer/SKILL.md