POP3 client for Rust
Clone or download
mattnenterprise Refactor Travis CI build (#15)
Building and testing are now done using the regular cargo tool.
Test coverage is only uploaded on linux stable. Use cargo
tarpaulin for uploading test coverage to coveralls
Latest commit 3510b61 Oct 16, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
src move regexes into lazy_static macro (#6) Oct 4, 2017
.gitignore Initial Commit Nov 17, 2014
.travis.yml Refactor Travis CI build (#15) Oct 16, 2017
Cargo.toml move regexes into lazy_static macro (#6) Oct 4, 2017
LICENSE Initial Commit Nov 17, 2014
README.md Add documentation link in README (#10) Oct 16, 2017
example.rs update openssl and regex (#5) Mar 2, 2017



POP3 Client for Rust

This client has SSL support. SSL is configured using an SSLContext that is passed into the connect method of a POP3Stream. If no SSL support is wanted just pass in None. The library rust-openssl is used to support SSL for this project.

Number of Crate Downloads Crate Version Crate License Travis CI Build Status Coverage Status



extern crate pop3;
extern crate openssl;

use openssl::ssl::{SslContext, SslMethod};
use pop3::POP3Stream;
use pop3::POP3Result::{POP3Stat, POP3List, POP3Message};

fn main() {
    let mut gmail_socket = match POP3Stream::connect("pop.gmail.com", 995, Some(SslContext::new(SslMethod::Sslv23).unwrap())) {
        Ok(s) => s,
        Err(e) => panic!("{}", e)

    gmail_socket.login("username", "password");

    let stat = gmail_socket.stat();
    match stat {
        POP3Stat {num_email,
                  mailbox_size} => println!("num_email: {},  mailbox_size:{}", num_email, mailbox_size),
        _ => println!("Err for stat"),

    let list_all = gmail_socket.list(None);
    match list_all {
        POP3List {emails_metadata} => {
            for i in emails_metadata.iter() {
                println!("message_id: {},  message_size: {}", i.message_id, i.message_size);
        _ => println!("Err for list_all"),

    let message_25 = gmail_socket.retr(25);
    match message_25 {
        POP3Message{raw} => {
            for i in raw.iter() {
                println!("{}", i);
        _ => println!("Error for message_25"),