# sendgrid-mail

> The easiest way to send mail with sendgrid.

Latest version **0.0.3** (published 2021-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install sendgrid-mail
pnpm add sendgrid-mail
yarn add sendgrid-mail
bun add sendgrid-mail
```

Provides the command `sendgrid-mail`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-01-08 |
| First published | 2020-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Huned Botee |
| Maintainers | huned |
| Keywords | node.js, sendgrid, mail, email, sendmail |

## Links

- npm: https://www.npmjs.com/package/sendgrid-mail
- Repository: https://github.com/huned/nodejs-sendgrid-mail
- Homepage: https://github.com/huned/nodejs-sendgrid-mail#readme
- Issues: https://github.com/huned/nodejs-sendgrid-mail/issues
- npm.io page: https://npm.io/package/sendgrid-mail

## Dependencies (6)

- [bent](https://npm.io/package/bent.md) ^7.3.7
- [meow](https://npm.io/package/meow.md) ^7.0.1
- [debug](https://npm.io/package/debug.md) ^4.1.1
- [dotenv](https://npm.io/package/dotenv.md) ^8.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [get-stdin](https://npm.io/package/get-stdin.md) ^8.0.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2021-01-08
- 0.0.2 — 2020-07-03

## README

# Mail for Sendgrid

Main repo: [https://github.com/huned/nodejs-sendgrid-mail](https://github.com/huned/nodejs-sendgrid-mail)

This is the simplest way to send mail with sendgrid in node.js.

Features:

* Use as a library or as a command line utility
* Command line utility has a `mail` style interface and sensible defaults
* Supports sending plain text and html emails
* No bloat, few dependencies

## Installation

    npm install sendgrid-mail

## Usage

    sgSendmail = require('sendgrid-mail')

    sgSendmail({
      // Required SendGrid API key
      apikey: 'your sendgrid api key',

      // Optional to/cc/bcc fields.
      // Specify at least one email address in any of these fields.
      to: ['John Doe <john.doe@example.com>'],
      cc: [],
      bcc: [],

      // Optional from/replyTo fields.
      // The from address must be a verified sender in your SendGrid account.
      from: 'Jane Doe <jane.doe@example.com>',
      replyTo: 'noreply@example.com',

      // Optional subject of the email
      subject: 'test subject',

      // Optional body of the email
      body: 'plain text body',

      // Optional content type of email body.
      contentType: 'text/html',

      // Optionally avoid sending empty emails
      suppressEmpty: true,
    })

## Command Line Usage

    $ echo 'hello, world.' | sendgrid-mail -k <sendgrid api key> -s 'Test Subject' --from=sender@example.com recipient@example.com

You can specify options (see `sendgrid-mail --help` for more details)

    -E
    --suppressEmpty
        OPTIONAL
        Do not send messages with an empty body.

    -s <subject>
    --subject=<subject>
        OPTIONAL
        Specify subject on command line. (Only the first argument after the
        -s flag is used as a subject; be careful to quote subjects containing
        spaces.)

    -c <cc-addr>
    --cc=<cc-addr>
        OPTIONAL
        Send carbon copies to cc-addr list of users. The cc-addr argument
        should be a comma-separated list of email addresses.

    -b <bcc-addr>
    --bcc=<bcc-addr>
        OPTIONAL
        Send blind carbon copies to bcc-addr list of users. The bcc-addr
        argument should be a comma-separated list of email addresses.

    The following options are specific to this program and used when calling
    SendGrid's API v3 /mail/send endpoint.

    -k <api key>
    --key=<api key>
        REQUIRED
        Set a SendGrid API key. Can also be set by defining SENDGRID_API_KEY.

    --from=<from-addr>
        REQUIRED
        Set the from-addr for outgoing messages. Can also be set by defining
        SENDGRID_MAIL_FROM.

        **IMPORTANT** from-addr must be a verified sender for your SendGrid
        account.

    --replyTo=<replyto-addr>
        OPTIONAL
        Set the reply-to field for outgoing messages. Can also be set by
        defining SENDGRID_MAIL_REPLYTO. If unset, defaults to $REPLYTO.

    --html
        OPTIONAL
        Indicate that mail body content type is "text/html". If unset, mail
        content type is "text/plain".

## Author(s)

* [Huned Botee](huned@hunedbotee.com)

## License

MIT

## TODOs

* [ ] tests
* [ ] multipart email

---
_Source: https://npm.io/package/sendgrid-mail · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
