New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gmail-node-mailer

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gmail-node-mailer

The \`gmail-node-mailer\` package provides a streamlined way to send emails using the Gmail API within Node.js applications. This package simplifies the process of setting up the Gmail API client, validating email addresses, and sending emails. It also of

  • 1.6.607
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
decreased by-37.5%
Maintainers
1
Weekly downloads
 
Created
Source

Gmail Node Mailer

The `gmail-node-mailer` package provides a streamlined way to send emails using the Gmail API within Node.js applications. This package simplifies the process of setting up the Gmail API client, validating email addresses, and sending emails. It also offers flexibility by allowing users to configure the Gmail service account and sender email dynamically.

Features

  • Initialize the Gmail API client with service account credentials.
  • Validate sender and recipient email addresses.
  • Send emails with customizable sender, recipient, subject, and message content.
  • Configure service account and sender email through utility functions.

Getting Started

Installation

To install the package, run the following command in your Node.js project directory:

```bash npm install gmail-node-mailer ```

Usage

  1. Initialize the Gmail API Client

    Before sending emails, you must initialize the Gmail API client with your service account credentials.

    ```typescript import { GmailMailer } from 'gmail-node-mailer';

    const mailer = new GmailMailer();

    // Initialize with your service account credentials await mailer.initializeClient({ gmailServiceAccountPath: '/path/to/service-account.json', }); ```

  2. Send an Email

    After initializing the client, you can send emails by providing the sender, recipient, subject, and message.

    ```typescript const emailParams = { senderEmail: 'your-email@gmail.com', recipientEmail: 'recipient-email@gmail.com', subject: 'Hello from Gmail Node Mailer', message: 'This is a test email sent using the Gmail Node Mailer package.', };

    const response = await mailer.sendEmailWrapper(emailParams); console.log(response.message); ```

Configuration

  • Service Account: Set the path to your service account JSON file or directly provide the service account object.
  • Sender Email: Configure the default sender email address.

Utilities

This package includes utilities for validating email addresses, parsing service account files, and managing configuration settings.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check issues page.

License

Distributed under the MIT License. See `LICENSE` for more information.

FAQs

Package last updated on 28 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc