postal-rs

Crates.iopostal-rs
lib.rspostal-rs
version0.1.0
sourcesrc
created_at2020-10-25 14:12:30.882996
updated_at2020-10-25 14:12:30.882996
descriptionA libary which provides an API to Postal
homepage
repositoryhttps://github.com/zhiburt/postal-rs
max_upload_size
id305298
size18,107
Maxim Zhiburt (zhiburt)

documentation

README

postal-rs

A libarry which wraps HTTP API of Postal. It uses https://krystal.github.io/postal-api/controllers/messages.html as a source of documentation.

Get started

use postal_rs::{Client, DetailsInterest, Message, SendResult};
use std::env;

#[tokio::main]
async fn main() {
   let address = env::var("POSTAL_ADDRESS").unwrap_or_default();
   let token = env::var("POSTAL_TOKEN").unwrap_or_default();

   let message = Message::default()
       .to(&["example@gmail.com".to_owned()])
       .from("test@yourserver.io")
       .subject("Hello World")
       .text("A test message");
   let client = Client::new(address, token).unwrap();
   let _ = client
       .send(message)
       .await
       .unwrap();
}
Commit count: 8

cargo fmt