email-sdk
v1.1.1
Published
A simple TypeScript/JavaScript SDK for sending emails from Cloudflare Workers using the QodeML API.
Downloads
331
Readme
QodeML Email SDK
A simple TypeScript/JavaScript SDK for sending emails from Cloudflare Workers using the QodeML API.
Features
- Send plain text and HTML emails
- Easy configuration for host, authentication, and API key
Installation
npm install email-sdkUsage
import { QodeMLClient } from "email-sdk";
const client = new QodeMLClient({
host: "your-host.com",
port: 443,
useSsl: true,
username: "your-username",
password: "your-password",
method: "POST",
apiKey: "YOUR_API_KEY"
});
const mail = {
from: "[email protected]",
to: "[email protected]",
subject: "Test Email",
body: "Hello, this is a test email!",
isHtml: false
};
client.sendMail(mail)
.then(response => console.log("Email sent!", response))
.catch(error => console.error("Failed to send email:", error));Getting an API Key
To use this SDK, you need a QodeML API key. You can obtain your API key from the QodeML Email SDK dashboard:
Configuration
| Option | Description | |------------|-----------------------------| | host | QodeML API host URL | | port | Port number (e.g., 443) | | useSsl | Use SSL (true/false) | | username | Your QodeML username | | password | Your QodeML password | | method | HTTP method (usually POST) | | apiKey | Your QodeML API key |
License
MIT
