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:
- https://cloud.google.com/iam/docs/service-account-overview
- https://support.google.com/a/answer/162106?hl=en&fl=1&sjid=12697421685211806668-NA
- https://developers.google.com/gmail/api/guides
§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")?;
Modules§
- error
- Types for error handling.
Structs§
- Gmail
Client - A client ready to send emails through the Gmail API.
- Gmail
Client Builder - The
GmailClientBuilder
is the intended way of creating aGmailClient
.