Announcing the Rust SDK

You can now send emails with the official Resend SDK in your Rust projects.

Antonios BarotsisAntonios Barotsis

Rust has seen a rapid rise in popularity in the last few years, and one of the driving forces behind it has been the attention paid to type safety and developer ergonomics.

With those values in mind, today we are proud to announce the Resend Rust SDK.

The Early Beginnings

Last year, I was building a newsletter aggregator to help me keep up with blogs and articles I was interested in. I just so happened to see Resend's announcement on Twitter and wanted to try it out, considering I wanted to support multiple email backends.

I was quite early to the party, and since no crate was available at the time to interact with the Resend API, I decided to make my own. It ended up being the more popular option in the Rust ecosystem, and with the help of Resend's team, it now covers the entire API interface.

Getting started

First, add the necessary dependencies:

cargo add resend-rs
cargo add tokio -F macros,rt-multi-thread

You can now easily send your first email as follows:

use resend_rs::types::CreateEmailBaseOptions;
use resend_rs::{Resend, Result};
#[tokio::main]
async fn main() -> Result<()> {
let resend = Resend::new("re_123456789");
let from = "Acme <onboarding@resend.dev>";
let to = ["delivered@resend.dev"];
let subject = "Hello World";
let email = CreateEmailBaseOptions::new(from, to, subject)
.with_html("<strong>It works!</strong>");
let email = resend.emails.send(email).await?;
println!("{}", email.id);
Ok(())
}

More documentation is available to get you up to speed with everything:

Next steps

If you have any suggestions, issues or would like to contribute, check the GitHub repo.