[][src]Crate postal_rs

The crate provides an interface to Postal's http API.

Examples

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();
}

Structs

Client

Client holds a session information

DetailsInterest

DetailsInterest contains an options which can be used to turn on expansions while obtaining details of a message.

Message

Message represents a email which can be sent

RawMessage

RawMessage allows you to send us a raw RFC2822 formatted message along with the recipients that it should be sent to.

SendResult

SendResult represent a result of sending request

Enums

PostalError

PostalError denotes crate erorrs

Type Definitions

MessageHash

MessageHash represents a hash which can be used to get a different information bout a message.