#api #1secmail #wrapper #api-bindings

temp_mail

1secmail api wrapper for rust

6 releases

0.1.6 Sep 18, 2023
0.1.5 Sep 17, 2023

#138 in Email

MIT license

10KB
229 lines

temp_mail

Async Rust wrapper of 1secmail

use temp_mail::TempMail;

let mut email = TempMail::new();
email.generate_email().await?;


// or

let mut email2 = TempMail::from_string("myemail@something.com").await?;

now you can retrieve:

Email address

println!("{}", email.get_email());

Email messages

email.check_inbox().await?;

let messages = email.get_messages();

Open message

let message = email.get_message_by_id(id).await?

// message.id
// message.from
// message.subject
// message.date
// message.body
// message.text_body
// message.html_body
// message.attachments ->
// attachment.filename
// attachment.content_type
// attachment.size

Download attachment

email.download_attachment(message.id, message.attachments[0].filename.clone(),"file.extension".into()).await?; // not working for images for now

Get available domains

let domains = TempMail::get_domains().await?;

Get random addresses

let adresses = TempMail::get_adresses(Some(10)).await?;
let adresses = TempMail::get_adresses(None).await?; // returns 1 adress

Dependencies

~10–26MB
~332K SLoC