Quickstart
Prerequisites
Section titled “Prerequisites”- A verified domain
- An API key with sending access, saved as
MAILPIDGE_API_KEY
1. Install
Section titled “1. Install”npm install @mailpidge/sdkpip install mailpidgeNothing to install.
2. Send an email
Section titled “2. Send an email”import { MailPidgeClient } from '@mailpidge/sdk'
const mailpidge = new MailPidgeClient({ token: process.env.MAILPIDGE_API_KEY! })
const email = await mailpidge.emails.send({ from: 'Pidge Fit <hello@pidgefit.com>', to: ['you@example.com'], subject: 'Hello from MailPidge', html: '<p>It works.</p>',})
console.log(email.id)Run npx tsx send.ts.
import osfrom mailpidge import MailPidge
mailpidge = MailPidge(token=os.environ["MAILPIDGE_API_KEY"])
email = mailpidge.emails.send( from_="Pidge Fit <hello@pidgefit.com>", to=["you@example.com"], subject="Hello from MailPidge", html="<p>It works.</p>",)
print(email.id)Run python send.py.
curl https://api.mailpidge.com/api/v1/emails \ -H "Authorization: Bearer $MAILPIDGE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "from": "Pidge Fit <hello@pidgefit.com>", "to": ["you@example.com"], "subject": "Hello from MailPidge", "html": "<p>It works.</p>" }'from must use your verified domain.
Response
Section titled “Response”{ "id": "em_01JD4V8QK3S6T2Y9Z7XWB5N0RA", "suppressed": [] }The email arrives within a minute. Follow its status with webhooks or Get an email. Errors: Errors.