@opengovsg/postmangovsg-client
v0.0.9
Published
An OpenAPI client and nodemailer transport for postman.gov.sg
Downloads
1,473
Readme
postmangovsg-client
An OpenAPI client and nodemailer transport for postman.gov.sg
Usage
Nodemailer
A custom transport that wraps around the API Client for nodemailer is provided, so that users can send transactional emails using nodemailer's familiar programmatic API
import nodemailer from 'nodemailer'
import { PostmanNodemailerTransport } from '@opengovsg/postmangovsg-client'
const transport = new PostmanNodemailerTransport(process.env.POSTMANGOVSG_API_KEY)
const mailer = nodemailer.createTransport(transport)
const mail = {
to: '[email protected]',
subject: 'Hello World',
html: 'Product <b>Launched!</b>',
// text: 'Product Launched!',
}
mailer.sendMail(mail, (err, info) => {
if (err) {
console.error(err, info)
} else {
console.log(info)
}
})
API Client
An OpenAPI client was generated using openapi-generator
and the Postman OpenAPI spec. The resulting clients and models
are accessible via imports from @opengovsg/postmangovsg-client