Skip to content

Updated to native_tls, rustc 2021 edition, and created an example directory. #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

27 changes: 13 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
[package]

name = "pop3"
version = "1.0.6"
authors = ["Matt McCoy <mattnenterprise@yahoo.com>"]
homepage = "https://github.com/mattnenterprise/rust-pop3"
repository = "https://github.com/mattnenterprise/rust-pop3"
name = "rs-pop3"
version = "1.0.9"
edition = "2021"
authors = ["Matt McCoy <mattnenterprise@yahoo.com>", "K8sCat <k8scat@gmail.com>", "caret"]
homepage = "https://github.com/k8scat/rust-pop3"
repository = "https://github.com/k8scat/rust-pop3"
description = "POP3 client for Rust"
readme = "README.md"
license = "MIT"

[lib]
name = "pop3"
name = "rs_pop3"
path = "src/pop3.rs"

[[bin]]
name = "example"
path = "example.rs"

[dependencies]
openssl = "0.10"
regex = "1"
lazy_static = "1"
lazy_static = "1.4.0"
native-tls = "0.2.11"
regex = "1.7.0"
#openssl = "0.10"
#regex = "1"
#lazy_static = "1"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Matt McCoy
Copyright (c) 2014 Matt McCoy, K8sCat <k8scat@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
rust-pop3
================
# rust-pop3

**Forked https://github.com/mattnenterprise/rust-pop3**

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.
support is wanted just pass in None. The library was updated to use native-tls to support SSL connectivity for this project.

[![Number of Crate Downloads](https://img.shields.io/crates/d/pop3.svg)](https://crates.io/crates/pop3)
[![Crate Version](https://img.shields.io/crates/v/pop3.svg)](https://crates.io/crates/pop3)
[![Crate License](https://img.shields.io/crates/l/pop3.svg)](https://crates.io/crates/pop3)
[![Travis CI Build Status](https://travis-ci.org/mattnenterprise/rust-pop3.svg)](https://travis-ci.org/mattnenterprise/rust-pop3)
[![Coverage Status](https://coveralls.io/repos/github/mattnenterprise/rust-pop3/badge.svg?branch=master)](https://coveralls.io/github/mattnenterprise/rust-pop3?branch=master)
[![Number of Crate Downloads](https://img.shields.io/crates/d/rs-pop3.svg)](https://crates.io/crates/rs-pop3)
[![Crate Version](https://img.shields.io/crates/v/rs-pop3.svg)](https://crates.io/crates/rs-pop3)
[![Crate License](https://img.shields.io/crates/l/rs-pop3.svg)](https://crates.io/crates/rs-pop3)
[![Coverage Status](https://coveralls.io/repos/github/k8scat/rust-pop3/badge.svg?branch=master)](https://coveralls.io/github/k8scat/rust-pop3?branch=master)

[Documentation](https://docs.rs/pop3/)
[Documentation](https://docs.rs/rs_pop3/)

### Usage
```rust
extern crate pop3;
extern crate openssl;
## Usage

`Cargo.toml`

use openssl::ssl::{SslConnector, SslMethod};
use pop3::POP3Stream;
use pop3::POP3Result::{POP3Stat, POP3List, POP3Message, POP3Err};
```toml
[dependencies]
native-tls = "0.2.11"
rs-pop3 = "1.0.8"
```

`main.rs`

```rust
use native_tls::TlsConnector;
use rs_pop3::POP3Stream;
use rs_pop3::POP3Result::{POP3Stat, POP3List, POP3Message, POP3Err};

fn main() {
let mut gmail_socket = match POP3Stream::connect(("pop.gmail.com", 995), Some(SslConnector::builder(SslMethod::tls()).unwrap().build()),"pop.gmail.com") {
let mut gmail_socket = match POP3Stream::connect(("pop.gmail.com", 995), Some(TlsConnector::new().unwrap()),"pop.gmail.com") {
Ok(s) => s,
Err(e) => panic!("{}", e)
};
Expand All @@ -36,9 +45,9 @@ fn main() {

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"),
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);
Expand All @@ -65,6 +74,6 @@ fn main() {
}
```

### License
## License

MIT
[MIT](https://github.com/k8scat/rust-pop3/blob/master/LICENSE)
10 changes: 10 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Examples
========

This directory contains examples of working with the POP3 client.

Examples:
* gmail - This is a very basic example of using the client.

How to run:
`cargo run --example gmail`
12 changes: 5 additions & 7 deletions example.rs → examples/gmail.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
extern crate pop3;
extern crate openssl;

use openssl::ssl::{SslConnector, SslMethod};
use pop3::POP3Stream;
use pop3::POP3Result::{POP3Stat, POP3List, POP3Message, POP3Err};
use native_tls::TlsConnector;
use rs_pop3::POP3Stream;
use rs_pop3::POP3Result::{POP3Stat, POP3List, POP3Message, POP3Err};

fn main() {
let mut gmail_socket = match POP3Stream::connect(("pop.gmail.com", 995), Some(SslConnector::builder(SslMethod::tls()).unwrap().build()),"pop.gmail.com") {
// let mut gmail_socket = match POP3Stream::connect(("pop.gmail.com", 995), Some(SslConnector::builder(SslMethod::tls()).unwrap().build()),"pop.gmail.com") {
let mut gmail_socket = match POP3Stream::connect(("pop.gmail.com", 995), Some(TlsConnector::new().unwrap()),"pop.gmail.com") {
Ok(s) => s,
Err(e) => panic!("{}", e)
};
Expand Down
Loading