Crates.io | mail-test-account |
lib.rs | mail-test-account |
version | 0.1.1 |
source | src |
created_at | 2019-03-04 12:25:31.618573 |
updated_at | 2019-03-04 12:25:31.618573 |
description | creates/loads/stores a mail account for testing purpose :(currently using ethereal.mail) |
homepage | |
repository | https://github.com/1aim/mail-test-account |
max_upload_size | |
id | 118623 |
size | 21,951 |
Documentation can be viewed on docs.rs.
A library for loading/storing and creating new mail test accounts. The accounts will be for servers/services which provide a Mail Submission Agent (MSA) which accepts but never delivers mails and from which you can access the mail.
Currently ethereal.mail
is used as a service for creating new accounts.
Before creating a account the library tries to load account infos from
a config dir (using the xdg directory spec). The default account stored
and loaded by the test_account_info()
function are stored at
~/.config/mail-test-account/test_account.json
. If a different tag is
used the file name will change (the default tag is test_account
).
The config dir can be changed in the same way you can change a xdg
config dir (E.g. using the XDG_CONFIG_HOME
environment variable).
This crate can be used in three ways:
cargo run --features="clap"
),
which outputs pretty printed JSON.cargo run --example readme
),
which outputs information formated for human consumption.You can run the example below with cargo run --example readme
.
use mail_test_account::test_account_info;
fn main() {
let info = test_account_info().unwrap();
println!("ACCOUNT/CREDENTIALS");
println!(" username: {}", info.account.username);
println!(" password: {}", info.account.password);
if let Some(smtp) = info.smtp {
println!("SMTP");
println!(" host: {}", smtp.host);
println!(" port: {}", smtp.port);
if smtp.use_tls_directly {
println!(" use non standard direct TLS instead of STARTTLS");
} else {
println!(" use STARTTLS");
}
}
if let Some(imap) = info.imap {
println!("IMAP");
println!(" host: {}", imap.host);
println!(" port: {}", imap.port);
}
if let Some(pop3) = info.pop3 {
println!("POP3");
println!(" host: {}", pop3.host);
println!(" port: {}", pop3.port);
}
if let Some(web) = info.web {
println!("WEBSITE");
println!(" uri: {}", web.uri);
}
}
Outputs something like:
ACCOUNT/CREDENTIALS
username: ----@ethereal.email
password: -------------------
SMTP
host: smtp.ethereal.email
port: 587
use STARTTLS
IMAP
host: imap.ethereal.email
port: 993
POP3
host: pop3.ethereal.email
port: 995
WEBSITE
uri: https://ethereal.email
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.