@emercury/smtp-sdk
v1.0.1
Published
Official TypeScript SDK for the Emercury SMTP API
Maintainers
Readme
Emercury SMTP SDK for TypeScript
The official TypeScript client for sending transactional email and reading outbound delivery statistics through the stable Emercury SMTP API. It uses the standard Fetch API and works in current Node.js and browser runtimes.
Installation
npm install @emercury/smtp-sdkSend an email
import { Configuration, EmailApi } from '@emercury/smtp-sdk';
const api = new EmailApi(new Configuration({
apiKey: process.env.EMERCURY_API_TOKEN,
}));
const result = await api.sendEmail({
idempotencyKey: crypto.randomUUID(),
sendEmailRequest: {
from: { email: '[email protected]', name: 'Example' },
to: { email: '[email protected]' },
subject: 'Hello from Emercury',
contents: [{
contentType: 'text/plain',
content: 'Your transactional email is ready.',
}],
},
});Use a unique idempotency key when a send may be retried. The same key and normalized payload return the original
response for 24 hours; reusing a key with a different payload returns 409 Conflict.
