postmark

Crates.iopostmark
lib.rspostmark
version0.11.0
sourcesrc
created_at2021-07-06 13:20:26.971317
updated_at2024-09-03 14:34:15.612941
descriptionPostmark rust client
homepagehttps://github.com/pastjean/postmark-rs
repositoryhttps://github.com/pastjean/postmark-rs
max_upload_size
id419447
size113,138
Pierre-Alexandre St-Jean (pastjean)

documentation

https://docs.rs/postmark

README

Postmark

ci crates.io Documentation License

A rust library to query Postmark API.

Usage

Add the crate dependency to your Cargo.toml:

[dependencies]
postmark = "x.y.z"

And use it, see documentation at: https://docs.rs/postmark.

use postmark::reqwest::PostmarkClient;
use postmark::api::email::{SendEmailRequest,Body};

async fn send_email(){
  let client = PostmarkClient::builder()
   .server_token("<sometoken>")
   .build();

  let req = SendEmailRequest::builder()
    .from("me@example.com")
    .to("you@example.com")
    .body(Body::text("it's me, Mario!".to_string()))
    .build();
  let resp = req.execute(&client).await;
}

Releasing a new version

Prerequisite:

cargo install cargo-release

On Release:

cargo release --dry-run
# check it does the good thing
cargo release

Thanks

This crate is heavily inspired by the article "Designing Rust bindings for REST APIs by Ben Boeckel.

License

postmark is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

Commit count: 63

cargo fmt