|
| 1 | +If you have a non-library SendGrid issue, please contact our [support team](https://support.sendgrid.com). |
| 2 | + |
| 3 | +If you can't find a solution below, please open an [issue](https://github.com/sendgrid/sendgrid-nodejs/issues). |
| 4 | + |
| 5 | + |
1 | 6 | ## Table of Contents
|
2 |
| -* [Viewing Mail Header](#mail-header) |
3 | 7 |
|
4 |
| -<a name="mail-header"></a> |
5 |
| -## Viewing Mail Header |
| 8 | +* [Versions](#versions) |
| 9 | +* [Using the Package Manager](#package-manager) |
| 10 | +* [Viewing the Request Body](#stmpapi-header) |
| 11 | + |
| 12 | +<a name="versions"></a> |
| 13 | +## Versions |
| 14 | + |
| 15 | +We follow the MAJOR.MINOR.PATCH versioning scheme as described by [SemVer.org](http://semver.org). Therefore, we recommend that you always pin (or vendor) the particular version you are working with to your code and never auto-update to the latest version. Especially when there is a MAJOR point release, since that is guaranteed to be a breaking change. Changes are documented in the [CHANGELOG](https://github.com/sendgrid/smtpapi-nodejs/blob/master/CHANGELOG.md) section. |
| 16 | + |
| 17 | +<a name="package-manager"></a> |
| 18 | +## Using the Package Manager |
| 19 | + |
| 20 | +We upload this library to [npm](https://www.npmjs.com/package/sendgrid) whenever we make a release. This allows you to use [npm](https://www.npmjs.com) for easy installation. |
| 21 | + |
| 22 | +In most cases we recommend you download the latest version of the library, but if you need a different version, please use: |
| 23 | + |
| 24 | +`npm install @sendgrid/[package name]@X.X.X` |
| 25 | + |
| 26 | +Please check [here](https://www.npmjs.com/org/sendgrid) for a list of package names. |
| 27 | + |
| 28 | +If you are using a `package.json` file: |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + ... |
| 33 | + "dependencies": { |
| 34 | + ... |
| 35 | + "@sendgrid/[package name]": "X.X.X" |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +<a name="stmpapi-header"></a> |
| 41 | +## Outputting the STMPAPI Header |
| 42 | + |
| 43 | +You can output the header by the following: |
| 44 | + |
| 45 | +```javascript |
| 46 | + var header = new smtpapi(); |
| 47 | + ... |
| 48 | + console.log(header.jsonString()); |
| 49 | +``` |
6 | 50 |
|
7 |
| -When debugging or testing, it may be useful to examine pending header to be sent. |
| 51 | +or use it in your options for the transport (Nodemailer example): |
8 | 52 |
|
9 |
| -```js |
10 |
| -console.log(header.get()) |
| 53 | +```javascript |
| 54 | + var headers = { 'x-smtpapi': header.jsonString() }; |
| 55 | + ... |
| 56 | + var mailOptions = { |
| 57 | + ... |
| 58 | + headers: headers |
| 59 | + } |
11 | 60 | ```
|
0 commit comments