email-connector
v1.0.3
Published
Connector for Gmail to send mails.
Downloads
3
Readme
email-connector
Connector for Gmail to send mails.
INSTALLATION
bash npm i email-connector
Usage
Importing the Library
const { createTransporter, sendEmail } = require('email-connector');
Configure your Nodemailer transporter
const transporterConfig = { service: 'gmail', auth: { user: '[email protected]', pass: 'PASSWORD', }, };
replace user , pass with the actual gmail id and the password.
Email options
const mailOptions = { from: '[email protected]', to: '[email protected]', subject: 'test mail', attachments:[ { filename: 'filename' , path: '/path' } ], text: 'Hello, this is a test email!', };
replace from , to with the actual gmail id , attachments , text as per your requirement.
NOTE:
Before importing this library make sure to enable the "Less secure app access" If you cannot find the "Less secure app access" option in your account settings. use an "App Password " instead of your account password. App Passwords are generated specifically for apps or devices that don't support 2FA directly. You can generate App Passwords in your Google Account security settings.