Crates.io | postal-rs |
lib.rs | postal-rs |
version | 0.1.0 |
source | src |
created_at | 2020-10-25 14:12:30.882996 |
updated_at | 2020-10-25 14:12:30.882996 |
description | A libary which provides an API to Postal |
homepage | |
repository | https://github.com/zhiburt/postal-rs |
max_upload_size | |
id | 305298 |
size | 18,107 |
A libarry which wraps HTTP API of Postal. It uses https://krystal.github.io/postal-api/controllers/messages.html as a source of documentation.
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();
}