Rust

Official Rust SDK — cargo add resent

Install the Resent client:

$cargo add resent
$cargo add tokio --features macros,rt-multi-thread
1use resent::{Resent, SendEmail};
2
3#[tokio::main]
4async fn main() -> Result<(), resent::Error> {
5 let resent = Resent::new(std::env::var("RESENT_API_KEY").expect("RESENT_API_KEY"));
6
7 let result = resent
8 .emails()
9 .send(
10 SendEmail::new(
11 "Acme <noreply@yourdomain.com>",
12 ["you@example.com"],
13 "Hello World",
14 )
15 .html("<strong>It works!</strong>"),
16 )
17 .await?;
18
19 println!("{:?}", result.submission_id);
20 Ok(())
21}