mailgun-utility
v1.0.0
Published
A utility for interacting with the Mailgun API
Downloads
8
Readme
Mailgun Utility
A simple utility for interacting with the Mailgun API
Installation
npm install mailgun-utility
Usage
import { createMailgunClient } from "mailgun-utility";
const mailgunClient = createMailgunClient("YOUR_DOMAIN_NAME", "YOUR_API_KEY");
// Send an email
mailgunClient
.sendEmail({
from: "[email protected]",
to: "[email protected]",
subject: "Test Email",
html: "<h1>Hello!</h1><p>This is a test email.</p>",
})
.then((result) => console.log("Email sent:", result))
.catch((error) => console.error("Failed to send email:", error));
// Validate an email
mailgunClient
.validateEmail("[email protected]")
.then((result) => console.log("Validation result:", result))
.catch((error) => console.error("Failed to validate email:", error));