plunk-0.1.0 is not a library.
Visit the last successful build:
plunk-0.1.2
Plunk Email SDK
A simple Rust SDK for sending transactional emails using the Plunk API.
Setup
- Add dependencies to your
Cargo.toml:
[]
= "0.12.15"
= "1.44.2"
= "1.0.219"
= "0.1.0"
= "0.15.0"
- Create a
.envfile with your credentials:
PLUNK_PRIVATE_KEY=your_plunk_api_key_here
Quick Start
use ;
use PlunkClient;
// Initialize the client
let plunk_key = var.expect;
let client = new;
// Create an email payload
let payload = PlunkPayloads ;
// Send the email
match client.send_transactional_email.await
API Reference
PlunkClient
Initialize a new Plunk client:
let client = new;
PlunkPayloads
Structure for creating email payloads:
| Field | Type | Description |
|---|---|---|
| to | String | Recipient's email address |
| subject | Option | Email subject (optional) |
| body | String | Email content (supports HTML) |
Sending Emails
The send_transactional_email function returns a Result with either a success message or an error:
async
Error Handling
The SDK handles two main types of errors:
- Environment variable errors (missing API key)
- Email sending failures
Always wrap the email sending operation in a proper error handling block:
match client.send_transactional_email.await
License
MIT