A small unofficial library to send emails using Sendgrid.

Related tags

Email rust email sendgrid
Overview

sendgrid_thin

Tests

A thin wrapper around the SendGrid V3 API.

It does not use the crate tokio or hyper and is therefore very lightweight and do not interfere with your existing runtime.

You can use it inside your Actix, Axum or Rocket application without any problems.

To get the API key, you need to create an account on SendGrid and create an API key.

I recommend the dotenvy crate to load the API key from an environment variable.

Usage

     use sendgrid_thin::{Sendgrid, ContentType};

     fn main() {
        let mut sendgrid = Sendgrid::new("SENDGRID_API_KEY");

        // Required
        sendgrid
            .set_to_emails(&["[email protected]", "[email protected]"])
            .set_from_email("[email protected]")
            .set_subject("subject of email")
            .set_body("body of email");

        // Optional
        sendgrid
            .set_content_type(ContentType::Html)
            .set_send_at(1668281500)
            .set_cc_emails(&["[email protected]", "[email protected]"]);

        // Send the email
        match sendgrid.send() {
            Ok(message) => println!("{}", message),
            Err(err) => println!("Error sending email: {}", err),
        }
     }
You might also like...
Send emails right from the terminal using Rust!

Send emails right from the terminal using Rust!

Send nice emails
Send nice emails

Jolimail is an open source alternative to all the transactionnal email solutions. Why did we build jolimail? Jolimail comes from the frustration of us

Announce blogs and send emails. Originally built for ConnectDome.
Announce blogs and send emails. Originally built for ConnectDome.

ConnectDome - Rust Notify A simple service to announce new blogs on your Slack/Discord + send emails to your list via your TES. Feature 1: Posts blogs

Small crate to extend `reqwest` to be able to send with digest auth flow.

diqwest This crate extends reqwest to be able to send requests with digest auth flow. It is currently implemented for async usage only. When you send

Visually cluster your emails by sender, domain, and more to identify waste
Visually cluster your emails by sender, domain, and more to identify waste

Postsack A high level visual overview of swaths of email TLDR! A web demo that shows how Postsack clusters a set of 10.000 fake emails Do you have man

An utility to help developers manage their emails, notes and tasks effectively

nitride An admin dashboard built on Vue.js, TypeScript, Rust, and PostgreSQL. See the User Interface source code here. Requirement Rust v1.63 or great

A Python package written in Rust for email verification without sending any emails.

PyRustify PyRustify is a Python package written in Rust that verifies the email addresses. Features Feature Description Syntax validation Checks if th

An (unofficial) Rust library for querying db-ip.com data

db_ip An (unofficial) library for querying db-ip.com CSV databases in safe Rust. This library is not affiliated with or endorsed by db-ip.com. Be advi

An unofficial and incomplete no_std Rust library for implementing the ElectricUI Binary Protocol
An unofficial and incomplete no_std Rust library for implementing the ElectricUI Binary Protocol

An unofficial and incomplete no_std Rust library for implementing the ElectricUI Binary Protocol

Unofficial python bindings for the rust llm library. 🐍❤️🦀

llm-rs-python: Python Bindings for Rust's llm Library Welcome to llm-rs, an unofficial Python interface for the Rust-based llm library, made possible

Unofficial Rust SDK library for Uniswap smart contracts.

uniswap-rs Unofficial Rust SDK library for Uniswap smart contracts. Quickstart Add this to your Cargo.toml: [dependencies] uniswap-rs = { git = "https

An unofficial client library for the fuzz-introspector API.

fuzz-introspector-client An unofficial client library for the fuzz-introspector API. Quickstart Add package as a dependency; cargo add fuzz-introspect

Unofficial Rust SDK library for Uniswap smart contracts.

uniswap-rs Unofficial Rust SDK library for Uniswap smart contracts. Quickstart Add this to your Cargo.toml: [dependencies] uniswap-rs = { git = "https

Send Windows 10 styled notifications on Windows 7.

win7-notifications Send Windows 10 styled notifications on Windows 7. Note: This crate requires a win32 event loop to be running, otherwise the notifi

pam-send-slack-message is a program that publishes messages on slack when a linux server is accessed through ssh.

pam-send-slack-message pam-send-slack-message is a program that publishes messages on slack when the linux server is accessed through ssh. Installatio

A Discord bot to send updates on queries in tori.fi

torimies-rs How the bot works? The bot works by making requests to the undocumented (and very bad) tori.fi api endpoint. The users can add and remove

Send copy events over the network

Copiepate Copiepate is a small utility to remotely set the content of a clipboard. I created this tool as I frequently use a remote tmux+vim setup and

 A Discord bot to send updates on queries in tori.fi
A Discord bot to send updates on queries in tori.fi

torimies-rs How the bot works? The bot works by making requests to the undocumented (and very bad) tori.fi api endpoint. The users can add and remove

Send files over TCP. Quick and simple. Made in Rust.

SFT Multithreaded utility to send files over TCP. The sender writes a header containing the filename, and then the contents of the file, buffered, to

Owner
Reinaldo Rozato Junior
404 bio.
Reinaldo Rozato Junior
Send nice emails

Jolimail is an open source alternative to all the transactionnal email solutions. Why did we build jolimail? Jolimail comes from the frustration of us

Jérémie Drouet 100 Dec 20, 2022
Visually cluster your emails by sender, domain, and more to identify waste

Postsack A high level visual overview of swaths of email TLDR! A web demo that shows how Postsack clusters a set of 10.000 fake emails Do you have man

Benedikt Terhechte 298 Dec 26, 2022
Pay a lightning email to send an email to the website owner

TODO USE human readable age in encryption (support "e" as backward compatible) go back to referrer or provided option save time taken to send email op

Riccardo Casatta 12 Aug 24, 2022
a mailer library for Rust

lettre A mailer library for Rust NOTE: this readme refers to the 0.10 version of lettre, which is still being worked on. The master branch and the alp

lettre 1.3k Jan 4, 2023
Rust library to parse mail files

mailparse A simple parser for MIME email messages. API The primary entry point for this library is the following function: parse_mail(&[u8]) -> Re

Kartikaya Gupta (kats) 150 Dec 27, 2022
Fast and robust e-mail parsing library for Rust

mail-parser mail-parser is an e-mail parsing library written in Rust that fully conforms to the Internet Message Format standard (RFC 5322), the Multi

Stalwart Labs 158 Jan 1, 2023
mail-builder is a flexible e-mail builder library written in Rust that generates RFC5322 compliant e-mail messages

mail-builder mail-builder is a flexible e-mail builder library written in Rust that generates RFC5322 compliant e-mail messages. The library has full

Stalwart Labs 37 Dec 19, 2022
An ESMTP server library written in Rust.

rs-smtp An ESMTP server library written in Rust. Features ESMTP client & server implementing RFC 5321 Support for SMTP AUTH and PIPELINING UTF-8 suppo

DUNEF 3 Apr 15, 2023
E-mail delivery library for Rust with DKIM support

mail-send mail-send is a Rust library to build, sign and send e-mail messages via SMTP. It includes the following features: Generates e-mail messages

Stalwart Labs 165 Oct 23, 2023
Unofficial Rust library for the SendGrid API

sendgrid-rs Unofficial Rust library for the SendGrid API. This crate requires Rust 1.15 or higher as it uses a crate that has a custom derive implemen

Garrett Squire 88 Dec 27, 2022