Prerequisites
Before you start, you’ll need:- A Resend API key
- A verified domain
Guide
Install
First, create a rust project with cargo and Next, add add the Rust Resend SDK as well as Tokio:The Rust SDK is Async-first so Tokio is needed.
cd into it.Reading the API key
Instead of using
Resend::new and hardcoding the API key, the RESEND_API_KEY environment variable
can be used instead. Use Resend::default() in that scenario instead.Another popular option is to use a .env file for environment variables. You can use the
dotenvy crate for that:Examples
Basic Send
Basic email sending
Attachments
Send emails with file attachments
Templates
Send emails using Resend hosted templates
Scheduling
Schedule emails for future delivery
Audiences
Manage contacts and audiences
Domains
Create and manage sending domains
Inbound Webhooks
Receive and process inbound emails
Double Opt-in
Double opt-in subscription flow
Axum App
Full Axum web framework application