nodemailer-lite
v1.0.1
Published
A friendly, minimal wrapper around [nodemailer](https://nodemailer.com) for sending email from any provider — without the verbose transporter config, callback juggling, or cryptic auth errors.
Readme
nodemailer-lite
A lightweight Node.js package that makes sending emails simple.
Built on top of Nodemailer, nodemailer-lite removes the boilerplate required to send emails from your applications. Send plain text or HTML emails, with attachments, through Gmail, Outlook, Zoho, Mailtrap, SendGrid, or any custom SMTP server, using a clean, promise-based API.
Features
- Send emails through Gmail, Outlook, Zoho, Mailtrap, SendGrid, AWS SES, or custom SMTP
- Plain text and HTML emails, with optional attachments
- Verify your connection/credentials before sending
- Friendly error messages instead of raw SMTP error codes
- Promise-based and beginner-friendly
Installation
npm install nodemailer-liteUsage
const mail = require('nodemailer-lite');
(async () => {
try {
mail.configure({
service: 'gmail',
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASS
});
await mail.verify();
await mail.sendMail(
'[email protected]',
'Hello!',
'This is a plain text email.'
);
} catch (err) {
console.error('Mail Error:', err.message);
}
})();API
configure(options)
Sets up the provider and login credentials. Accepts service (e.g. 'gmail', 'outlook365', 'zoho', 'mailtrap', 'sendgrid', 'ses-us-east-1') or host/port for a custom server, plus user and pass.
sendMail(to, subject, text)
Sends an email. Also accepts a single options object for more control:
{
to,
subject,
text,
html,
cc,
bcc,
attachments,
from
}verify()
Checks that the connection and credentials work, without sending an email.
Dependencies
- nodemailer — the only dependency; nodemailer-lite is a thin wrapper around it
Requirements
- Node.js v14+
- Internet access to connect to your mail provider
License
MIT
