# nodemailer-fetch

> GET HTTP contents

Latest version **2.1.0** (published 2016-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install nodemailer-fetch
pnpm add nodemailer-fetch
yarn add nodemailer-fetch
bun add nodemailer-fetch
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2016-10-08 |
| First published | 2015-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Andris Reinman |
| Maintainers | andris |
| Keywords | nodemailer, http |

## Links

- npm: https://www.npmjs.com/package/nodemailer-fetch
- Repository: https://github.com/nodemailer/nodemailer-fetch
- Homepage: https://github.com/nodemailer/nodemailer-fetch#readme
- Issues: https://github.com/nodemailer/nodemailer-fetch/issues
- npm.io page: https://npm.io/package/nodemailer-fetch

## 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

- 2.1.0 (latest) — 2016-10-08
- 2.0.0 — 2016-09-29
- 1.6.0 — 2016-08-18
- 1.5.0 — 2016-08-18
- 1.4.0 — 2016-02-11
- 1.3.0 — 2016-02-04
- 1.2.1 — 2016-01-18
- 1.2.0 — 2016-01-18
- 1.1.0 — 2016-01-18
- 1.0.0 — 2015-12-30

## README

# nodemailer-fetch

Fetches HTTP URL contents for [nodemailer](https://github.com/nodemailer/nodemailer).

[![Build Status](https://secure.travis-ci.org/nodemailer/nodemailer-fetch.svg)](http://travis-ci.org/nodemailer/nodemailer-fetch)
<a href="http://badge.fury.io/js/nodemailer-fetch"><img src="https://badge.fury.io/js/nodemailer-fetch.svg" alt="NPM version" height="18"></a>

## Usage

```javascript
var fetch = require('nodemailer-fetch');
fetch('http://www.google.com/').pipe(process.stdout);
```

The method takes the destination URL as the first and optional options object as the second argument.

The defaults are the following:

  * Default method is GET
  * Basic auth is supported
  * Up to 5 redirects are followed (Basic auth gets lost after first redirect)
  * gzip is handled if present
  * Cookies are supported
  * No shared HTTP Agent
  * Invalid SSL certs are allowed. Can be overwritten with the `tls` option

### options

Possible options are the following:

  * **userAgent** a string defining the User Agent of the request (by default not set)
  * **cookie** a cookie string or an array of cookie strings where a cookie is the value used by 'Set-Cookie' header
  * **maxRedirects** how many redirects to allow (defaults to 5, set to 0 to disable redirects entirely)
  * **method** HTTP method to use, defaults to GET (if `body` is set defaults to POST)
  * **body** HTTP payload to send. If the value is an object it is converted to an *x-www-form-urlencoded* payload, other values are passed as is. Unlike authentication data payload and method is preserved between redirects
  * **contentType** optional content type for the HTTP payload. Defaults to *x-www-form-urlencoded*. If the value is `false` then Content-Type header is not set
  * **tls** optional object of TLS options
  * **timeout** (milliseconds) sets timeout for the connection. Returns an error if timeout occurs
  * **headers** custom headers as an object where key is the header key and value is either a string or an array of strings for multiple values
  * **allowErrorResponse** of true then processes response even if the response code is non 2xx

  ```javascript
  var fetch = require('nodemailer-fetch');
  fetch('http://www.google.com/', {
      cookie: [
          'cookie_name1=cookie_value1',
          'cookie_name2=cookie_value2; expires=Sun, 16 Jul 3567 06:23:41 GMT',
      ],
      userAgent: 'MyFetcher/1.0'
  }).pipe(process.stdout);
  ```

> Cookies are domain specific like normal browser cookies, so if a redirect happens to another domain, then cookies are not passed to it, HTTPS-only cookies are not passed to HTTP etc.

## License
**MIT**

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