Unoficial wrapper for Mailjet API
Rust wrapper for Mailjet's API
Mailjet is a service provider for sending emails and SMS, visit https://www.mailjet.com/ for more information.
WARNING: This wrapper is not official, Mailjet won't provide any support for it.
Send a basic email
use ;
// Create mailjet client
let mailjet = from_api_keys;
// Create recipients
let to = from_email;
let from = from_email_and_name;
// Create message
let mut message = default;
message.to.push;
message.from = from;
message.html_part = "<h3>Dear passenger 1, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!</h3><br />May the delivery force be with you!".to_string;
message.text_part = "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!".to_string;
message.subject = "Your email flight plan!".to_string;
// Create send request
let mut send_request = default;
send_request.sandbox_mode = Some; // You can remove this when sending for real
send_request.messages.push;
// Send emails
let response = mailjet.send.unwrap;
The data structures
The request and response structures are the same as mailjet's JSONs with PascalCase field names converted into snake_case format as asked by rust. Everything is serializable/deserializable with serde, so you can easily go back to original JSON formats with serde_json.
For more information on JSON structures, go read https://dev.mailjet.com/email/guides/send-api-v31/