nm-sender
v1.0.3
Published
nodemailer wrapper with retries and other goodies
Downloads
8
Maintainers
Readme
nm-sender
Wrapper around nodemailer for sending emails via smtp with retries and on-error email notification
- pool is automatically set to
true
(maxConnections
: 5) mailOptions
- docs
install
npm i nm-sender
// ES6 modules
import NmSender from 'nm-sender';
// commonJS
const NmSender = require('nm-sender').default;
/**
* ALL OPTIONS
retryTime?: number;
maxRetries?: number;
host: string;
port: number;
tls?: boolean; // default true
user: string;
password: string;
defaultFromAddress: string;
errorAddress?: string;
*
*/
const e = new NmSender({
host: 'smtp.xxxx.com',
port: 465,
user: '[email protected]',
password: 'xxxx',
defaultFromAddress: '[email protected]',
});
// ...
// DOCS: https://nodemailer.com/message/
try {
await e.sendMail({
to: '[email protected]',
subject: 'My subject',
from: '[email protected]',
text: 'Hello my email world',
});
} catch (err) {
console.error(err);
}