@longnc/themartec-smtpapi
Version:
Build SendGrid X-SMTPAPI headers in nodejs. And this version for upgrade some packages to latest and fix security
92 lines (64 loc) • 3.04 kB
Markdown

[](https://github.com/themartec/smtpapi-nodejs/actions/workflows/test-and-deploy.yml)
[](https://www.npmjs.com/package/smtpapi)
[](LICENSE)
[](https://github.com/themartec/smtpapi-nodejs/graphs/contributors)
**This node module allows you to quickly and more easily generate SendGrid X-SMTPAPI headers.**
All updates to this module are documented in our [CHANGELOG](CHANGELOG.md).
- [Installation](
- [Quick Start](
- [Library Usage Documentation](USAGE.md)
- [How to Contribute](
- [About](
- [Support](
- [License](
<a name="installation"></a>
- Node.js version 4, 5, 6, 7, 8, 10, 12, 14, or 16
- The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=smtpapi-nodejs)
Update your environment with your SendGrid credentials. (if you will be sending via nodemailer or other SMTP transport)
```bash
echo "export SENDGRID_USERNAME='YOUR_USERNAME'" > sendgrid.env
echo "export SENDGRID_PASSWORD='YOUR_PASSWORD'" >> sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env
```
The following recommended installation requires [npm](https://npmjs.org/). If you are unfamiliar with npm, see the [npm docs](https://npmjs.org/doc/). Npm comes installed with Node.js since node version 0.8.x, therefore, you likely already have it.
Install smtpapi-nodejs and its dependencies:
```bash
npm install @longnc/themartec-smtpapi
```
- Please see [package.json](package.json)
<a name="quick-start"></a>
```javascript
var smtpapi = require("@longnc/themartec-smtpapi");
var header = new smtpapi();
header.addTo("test@example.com");
header.setUniqueArgs({ cow: "chicken" });
console.log(header.jsonString());
```
<a name="usage"></a>
<a name="contribute"></a>
We encourage contribution to our projects, please see our [CONTRIBUTING](CONTRIBUTING.md) guide for details.
Quick links:
- [Feature Request](CONTRIBUTING.md
- [Bug Reports](CONTRIBUTING.md
- [Improvements to the Codebase](CONTRIBUTING.md
- [Review Pull Requests](CONTRIBUTING.md
<a name="about"></a>
smtpapi-nodejs is maintained and funded by Twilio SendGrid, Inc. The names and logos for smtpapi-nodejs are trademarks of Twilio SendGrid, Inc.
<a name="support"></a>
If you need help with SendGrid, please check the [Twilio SendGrid Support Help Center](https://support.sendgrid.com).
<a name="license"></a>
[](LICENSE)