Crate rust_gmail

source ·
Expand description

A Rust library to interact with the google Gmail API using a service account.

Currently focused only on support for sending emails but this may change in the future. Available both as async (default) or as blocking using the “blocking” feature.

Note that usage of this lib will require a google API service account with domain wide delegation for gmail setup with a google cloud project with the gmail API enabled. Links for more information:

Features

There is currently only one feature, blocking which will add blocking alternatives to all async functions with the same name suffixed with _blocking. E.g. send_email_blocking instead of send_email.

Examples

Examples of how to use this crate.

Async Example

let email_client = GmailClient::builder(
    "service_account.json",
    "noreply@example.test",
)?
.build()
.await?;

email_client
    .send_email("some_user@domain.test")
    .await?;

Blocking Example

Note: Requires the blocking feature.

let email_client = GmailClient::builder(
    "service_account.json",
    "noreply@example.test",
)?
.build_blocking()?;

email_client
    .send_email_blocking("some_user@domain.test")?;

Structs