# sendgrid-web

> Easily send emails with sendgrid and node.js

Latest version **0.0.5** (published 2013-11-12) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2013-11-12 |
| First published | 2011-09-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Joshua Holbrook |
| Maintainers | jesusabdullah |

## Links

- npm: https://www.npmjs.com/package/sendgrid-web
- Repository: git@github.com:jesusabdullah/node-sendgrid-web
- Homepage: https://github.com/jesusabdullah/node-sendgrid-web
- Issues: https://github.com/jesusabdullah/node-sendgrid-web/issues
- npm.io page: https://npm.io/package/sendgrid-web

## Dependencies (1)

- [request](https://npm.io/package/request.md) ~2.27.0

## Recent versions

- 0.0.5 (latest) — 2013-11-12
- 0.0.4 — 2012-07-30
- 0.0.3 — 2012-06-29
- 0.0.2 — 2012-02-21
- 0.0.1 — 2011-12-30
- 0.0.0 — 2011-09-01

## README

# sendgrid-web

Send emails with [sendgrid](http://sendgrid.com) and node.js! This sendgrid module (there are others) uses their JSON web API and the [request](https://github.com/mikeal/request) module.

## Install:

    npm install sendgrid-web

## Example:

``` js
    var Sendgrid = require("sendgrid-web");

    var sendgrid = new Sendgrid({
      user: "josh.holbrook@gmail.com",
      key: "oh, like you need to know."
    });

    sendgrid.send({
      to: 'josh.holbrook@gmail.com',
      from: 'josh.holbrook@gmail.com',
      subject: 'Hello world!',
      html: '<h1>Hello world!</h1>'
    }, function (err) {
      if (err) {
        console.log(err);
      } else {
        console.log("Success.");
      }
    });
```

## Usage:

### new Sendgrid(credentials)

This constructor creates a new sendgrid object. The "credentials" object should contain:

* `user`: Your sendgrid username
* `key`: Your sendgrid API key/password

### sendgrid.send(options, cb)

Sends an email. Options are the same as those of the [sendgrid json web api](http://sendgrid.com/documentation/display/api/WebMail). Common ones include:

* **to:** The recipient of the email.
* **from:** The email address to reply back to.
* **subject:** The subject of the email.
* **html:** The body of the email, if it's intended to be treated like html.
* **text:** The body of the email, if it's intended to be treated like plaintext.

## Tests:

In order to run the tests, sendgrid needs a user, api key, and email addresses to send to and from. Before running these tests, open `./test/config-template.json`, edit it to contain your credentials and information, and save it as `./test/config.json`.

Then, you may run the tests with nodeunit:

    nodeunit test/*.js

**Author:** Joshua Holbrook

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