cali-email-service
This is the pacakge which have multiple email services.
1. NodeMailer
2. MailGun
Will add more services in future
Installation:
npm install multiple-email-service
To use NodeMailer follow the below steps
Step1: import nodimaler from multiple-email-service package
const { nodemailerSendEmail } = require('multiple-email-service');
Step2: construct the required params to send email and all params are mandatory.
Also use any one params body or htmlContent for mail content
example:
const emailParams = {
// count of retry to send mail if not sent
tryCount: 3,
// Create a Transporter
transporterHost: 'youremail_SMTP_HOST',
transporterPort: 'youremail_SMTP_PORT',
transporterEmail: 'youremail_SMTP_USERNAME',
transporterPassword: 'youremail_SMTP_PASSWORD',
// Create a MailOptions
from: 'fromemail@example.com',
to: 'toemail@example.com',
subject: 'mail subject',
body: 'mail body content',
htmlContent: '<p>html content</p>'
}
Step3: To send email add below code
nodemailerSendEmail(emailParams)