Struct smtpapi::Header [] [src]

pub struct Header { /* fields omitted */ }

Methods

impl Header
[src]

Constructs a new Header.

Examples

use smtpapi::{Header};

let header = Header::new();
println!("{}", header.to_json_string());

Returns the JSON String reprezentation of Header.

Examples

use smtpapi::{Header};

let header = Header::new();
println!("{}", header.to_json_string());

It appends a single email to the To header

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_to("email@domain.com");

It appends multiple emails to the To header

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_tos(vec!["email1@domain.com", "email2@domain.com"]);

It sets the value of the To header

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.set_tos(vec!["email1@domain.com", "email2@domain.com"]);

It adds a new substitution to a specific key

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_substitution("[name]", "my_name");

It adds a multiple substitutions to a specific key

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_substitutions("[name]", vec!["my_name_1", "my_name_2"]);

It sets the value of the substitutions on the Sub header

Examples

use smtpapi::{Header};
use std::collections::HashMap;

let mut header = Header::new();
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);

It sets the value for a specific section

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_section("-top-", "sample");

It sets the value for the Section header

Examples

use smtpapi::{Header};
use std::collections::HashMap;

let mut header = Header::new();
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);

It adds a new category to the Category header

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_category("welcome");

It adds multiple categories to the Category header

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_categories(vec!["welcome", "new_accounts"]);

It sets the value of the Categories field

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.set_categories(vec!["welcome", "new_accounts"]);

It sets the value of a specific unique argument

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_unique_arg("account_id", "123412-121-1212");

It will set the value of the Unique_args header

Examples

use smtpapi::{Header};
use std::collections::HashMap;

let mut header = Header::new();
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);

It will set the specific setting for a filter

Examples

use smtpapi::{Header};

let mut header = Header::new();
header.add_filter("clicktrack", "enabled", "1")
      .add_filter("opentrack", "enabled", "1");

It takes in a Filter struct with predetermined settings and sets it for such Filter key

Examples

use smtpapi::{Header, Filter};

let mut header = Header::new();
let mut filter = Filter::new();
filter.add_setting("enabled", "1");

header.set_filter("clicktrack", filter);

It sets the value of the IpPool field

Examples

use smtpapi::{Header};

let mut header = Header::new();

header.set_ip_pool("newsletter_pool");

It will set the value of the ASMGroupID field

Examples

use smtpapi::{Header};

let mut header = Header::new();

header.set_asm_group_id(1221);

It takes in a timestamp which determines when the email will be sent

Examples

use smtpapi::{Header};

let mut header = Header::new();

header.set_send_at(1453213937);

It takes in a timestamp and pushes it into a list. Must match length of To emails

Examples

use smtpapi::{Header};

let mut header = Header::new();

header.add_send_each_at(1453213937)
      .add_send_each_at(1453213939);

It takes an array of timestamps. Must match length of To emails

Examples

use smtpapi::{Header};

let mut header = Header::new();

header.set_send_each_at(vec![1453213939, 1453213932, 1453213933]);

Trait Implementations

impl Decodable for Header
[src]

Deserialize a value using a Decoder.

impl Encodable for Header
[src]

Serialize a value using an Encoder.

impl Debug for Header
[src]

Formats the value using the given formatter.

impl Clone for Header
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Drop for Header
[src]

A method called when the value goes out of scope. Read more

impl ToJson for Header
[src]

Constructs the JSON reprezentation of Header.

impl Display for Header
[src]

Implement Display for Header

Formats the value using the given formatter. Read more