Rust
Introduction
Learn how to send your first email using the Resend Rust SDK.
Prerequisites
To get the most out of this guide, you’ll need to:
Install
First, create a rust project with cargo and cd
into it.
Next, add add the Rust Resend SDK as well as Tokio:
The Rust SDK is Async-first so Tokio is needed.
Send email
Reading the API key
Instead of using Resend::new
and hardcoding the API key, the RESEND_API_KEY
environment variable
can be used instead. The Resend::default()
should be used in that scenario instead.
Reading the API key from a .env
file
Another popular option is to use a .env
file for environment variables. You can use the
dotenv crate for that:
Was this page helpful?