Crates.io | smtpapi |
lib.rs | smtpapi |
version | 0.1.3 |
source | src |
created_at | 2016-01-21 18:57:14.724414 |
updated_at | 2016-03-08 13:19:16.525973 |
description | This crate allows you to quickly and more easily generate SendGrid X-SMTPAPI headers. |
homepage | https://github.com/bsorin/smtpapi-rs |
repository | https://github.com/bsorin/smtpapi-rs |
max_upload_size | |
id | 3944 |
size | 38,331 |
This crate allows you to quickly and more easily generate SendGrid X-SMTPAPI headers.
use smtpapi::{Header};
let mut header = Header::new();
use smtpapi::{Header};
let mut header = Header::new();
header.add_to("email@domain.com");
// or
header.add_tos(vec!["email1@domain.com", "email2@domain.com"]);
// or
header.set_tos(vec!["email1@domain.com", "email2@domain.com"]);
use smtpapi::{Header};
let mut header = Header::new();
header.add_substitution("[name]", "my_name");
// or
header.add_substitutions("[name]", vec!["my_name_1", "my_name_2"]);
// or
let mut all_subs : HashMap<String, Vec<String>> = HashMap::new();
all_subs.insert("-item1-".to_string(), vec!["rust".to_string(), "power".to_string()]);
all_subs.insert("-item2-".to_string(), vec!["rust".to_string(), "power".to_string()]);
header.set_substitutions(all_subs);
use smtpapi::{Header};
let mut header = Header::new();
header.add_section("-top-", "sample");
// or
let mut sections : HashMap<String, String> = HashMap::new();
sections.insert("-item1-".to_string(), "value1".to_string());
sections.insert("-item2-".to_string(), "value2".to_string());
header.set_sections(sections);
use smtpapi::{Header};
let mut header = Header::new();
header.add_category("welcome");
// or
header.add_categories(vec!["welcome", "new_accounts"]);
// or
header.set_categories(vec!["welcome", "new_accounts"]);
use smtpapi::{Header};
let mut header = Header::new();
header.add_unique_arg("account_id", "123412-121-1212");
// or
let mut unique_args : HashMap<String, String> = HashMap::new();
unique_args.insert("-arg1-".to_string(), "value1".to_string());
unique_args.insert("-arg2-".to_string(), "value2".to_string());
header.set_unique_args(unique_args);
use smtpapi::{Header, Filter};
let mut header = Header::new();
header.add_filter("clicktrack", "enabled", "1")
.add_filter("opentrack", "enabled", "1");
// or
let mut filter = Filter::new();
filter.add_setting("enable", "1")
.add_setting("text/plain", "You can haz footers!");
header.set_filter("footer", filter);
use smtpapi::{Header};
let mut header = Header::new();
header.set_send_at(1453213937);
// or
header.set_send_each_at(vec![1453213939, 1453213932, 1453213933]);
// or
header.add_send_each_at(1453213937)
.add_send_each_at(1453213939);
use smtpapi::{Header};
let mut header = Header::new();
header.set_asm_group_id(1221);
use smtpapi::{Header};
let mut header = Header::new();
header.set_ip_pool("newsletter_pool");
use smtpapi::{Header};
let mut header = Header::new();
header.to_json_string();
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)cargo test
```
## MIT License