gror_mail
v1.0.40
Published
a module to be used to generated pdf or send emails directly
Downloads
30
Readme
Gror Mail
- module
Gror Mail is a Node.js module for sending email messages with PDF attachments using the Mailjet email service and the Nodemailer library and uses the pdf package to generate PDFs from HTML.
This also has the zipping capabilities for large files.
Installation
To use this module, you first need to install it and its dependencies:
Copy code
npm install gror_mail
Usage
First, you need to initialize the module with username and password:
Copy code
const email_handler = require('gror_mail');
email_handler.init('username', 'password');
Then, you can use the sendEmailWithPdf function to send an email with a PDF attachment:
Copy code
const html = '<p>Hello, world!</p>';
const fileName = 'example.pdf';
const subject = 'Example Subject';
const text = 'This is an example email.';
const recipients = ['[email protected]', '[email protected]'];
const zip_required = false
email_handler.sendEmailWithPdf(html, fileName, subject, text,recipients,zip_required);
The sendEmailWithPdf function takes five arguments:
- html: The HTML content to generate the PDF from
- fileName: The name of the PDF file to attach to the email
- subject: The subject line of the email
- text: The text content of the email
- recipients: An array of recipient email addresses
- zip_required: a boolean if the document should be zipped or not ( default is false)
License
This module is licensed under the MIT License.