Skip to content

spoj/tiny-msg-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A tiny Outlook Email Message (.msg) reader

A tiny reader for .msg files. Supports embedded messages.

Usage Example

use tiny_msg::Email;

fn main() {
    let email = Email::from_path("sample/sample1.msg");
    // basic headers
    println!("From: {:?}", email.from.unwrap());
    println!("To: {:?}", email.to);
    println!("Cc: {:?}", email.cc);
    println!("Subject: {}", email.subject.unwrap());
    println!();
    // email body
    println!("Body starts with: {:?}", &email.body.unwrap()[..50]);
    println!();
    // attachments
    println!(
        "Attachments: {:?}",
        email
            .attachments
            .iter()
            .map(|a| a.name.clone())
            .collect::<Vec<_>>()
    );
    println!();
    // embedded messages
    println!(
        "Embedded Messages: {:?}",
        email
            .embedded_messages
            .iter()
            .map(|m| m.subject.as_ref().unwrap())
            .collect::<Vec<_>>()
    );
    println!();
    // OUTPUT: 
    // From: ("spoj", "[email protected]")
    // To: [("john", "[email protected]")]
    // Cc: [("karen", "[email protected]")]
    // Subject: Weekend plan

    // Body starts with: "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html"

    // Attachments: ["image001.png", "image002.png"]

    // Embedded Messages: ["Your flight itinerary"]
}

More examples in the examples directory.

About

A tiny .msg reader library for rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages