Module sparkpost::transmission[][src]

Module contains sprakpost email sending api

Example



use sparkpost::transmission::{Message, EmailAddress, Transmission, TransmissionResponse};
let tm = Transmission::new("api_key_form_env".to_string(),
                          "https://api.eu.sparkpost.com/api/v1/transmissions".into());

let mut email = Message::new(EmailAddress::with_name("marketing@example.sink.sparkpostmail.com", "Example Company"));
email.add_recipient("wilma@example.sink.sparkpostmail.com".into())
       .campaign_id("postman_inline_both_example")
       .subject("SparkPost inline template example")
       .html("<html><body>Here is your inline html, {{first_name or 'you great person'}}!<br></body></html>")
       .text("Here is your plain text, {{first_name or 'you great person'}}!");
// send message
// returns result with Transmission Response or reqwest::error::Error
let response: Result<TransmissionResponse, _> = tm.send(&email);

Structs

ApiError

Transmission error returned by the API

ApiResponse

Transmission result returned by the API

Attachment

Attachment data

Content
EmailAddress

Email address with name

Message

Represents email message including some mata-data

Options

Message options for a particular Message

Recipient
Transmission

Sparkpost Transmission currently only supports sending email message

Enums

TransmissionResponse

Wrapper Enum for ApiResponse and ApiError