项目作者: zhiburt

项目描述 :
An http postal API library
高级语言: Rust
项目地址: git://github.com/zhiburt/postal-rs.git
创建时间: 2020-10-24T20:19:38Z
项目社区:https://github.com/zhiburt/postal-rs

开源协议:MIT License

下载


Crates.io
Documentation

postal-rs is 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

  1. use postal_rs::{Client, DetailsInterest, Message, SendResult};
  2. use std::env;
  3. #[tokio::main]
  4. async fn main() {
  5. let address = env::var("POSTAL_ADDRESS").unwrap_or_default();
  6. let token = env::var("POSTAL_TOKEN").unwrap_or_default();
  7. let message = Message::default()
  8. .to(&["example@gmail.com".to_owned()])
  9. .from("test@yourserver.io")
  10. .subject("Hello World")
  11. .text("A test message");
  12. let client = Client::new(address, token).unwrap();
  13. let _ = client
  14. .send(message)
  15. .await
  16. .unwrap();
  17. }