Update documentation
This commit is contained in:
11
Cargo.toml
11
Cargo.toml
@@ -2,16 +2,13 @@
|
||||
|
||||
name = "smtp"
|
||||
version = "0.0.7"
|
||||
authors = ["Alexis Mousset <contact@amousset.eu>"]
|
||||
description = "Simple SMTP client and library"
|
||||
|
||||
description = "Simple SMTP client"
|
||||
readme = "README.md"
|
||||
documentation = "http://amousset.github.io/rust-smtp/smtp/"
|
||||
repository = "https://github.com/amousset/rust-smtp"
|
||||
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
||||
keywords = ["email", "smtp"]
|
||||
authors = ["Alexis Mousset <contact@amousset.me>"]
|
||||
keywords = ["email", "smtp", "mailer"]
|
||||
|
||||
[dependencies]
|
||||
time = "*"
|
||||
|
||||
0
src/client/authentication.rs
Normal file
0
src/client/authentication.rs
Normal file
@@ -129,7 +129,7 @@ impl<S = TcpStream> Client<S> {
|
||||
pub fn new<A: ToSocketAddr>(addr: A) -> Client<S> {
|
||||
Client{
|
||||
stream: None,
|
||||
server_addr: addr.to_socket_addr().unwrap(),
|
||||
server_addr: addr.to_socket_addr().ok().expect("could not parse server address"),
|
||||
server_info: None,
|
||||
configuration: Configuration {
|
||||
connection_reuse_count_limit: 100,
|
||||
@@ -232,7 +232,6 @@ impl<S: Connecter + ClientStream + Clone = TcpStream> Client<S> {
|
||||
if self.credentials.is_some() && self.state.connection_reuse_count == 0 {
|
||||
let credentials = self.credentials.clone().unwrap();
|
||||
if self.server_info.as_ref().unwrap().supports_feature(Extension::CramMd5Authentication).is_some() {
|
||||
|
||||
let result = self.auth_cram_md5(credentials.username.as_slice(),
|
||||
credentials.password.as_slice());
|
||||
try_smtp!(result, self);
|
||||
@@ -260,8 +259,6 @@ impl<S: Connecter + ClientStream + Clone = TcpStream> Client<S> {
|
||||
info!("{}: from=<{}>", current_message, from_address);
|
||||
|
||||
// Recipient
|
||||
// TODO Return rejected addresses
|
||||
// TODO Limit the number of recipients
|
||||
for to_address in to_addresses.iter() {
|
||||
try_smtp!(self.rcpt(to_address.as_slice()), self);
|
||||
// Log the rcpt command
|
||||
@@ -285,7 +282,7 @@ impl<S: Connecter + ClientStream + Clone = TcpStream> Client<S> {
|
||||
|
||||
// Test if we can reuse the existing connection
|
||||
if (!self.configuration.enable_connection_reuse) ||
|
||||
(self.state.connection_reuse_count == self.configuration.connection_reuse_count_limit) {
|
||||
(self.state.connection_reuse_count >= self.configuration.connection_reuse_count_limit) {
|
||||
self.reset();
|
||||
}
|
||||
|
||||
@@ -306,8 +303,7 @@ impl<S: Connecter + ClientStream + Clone = TcpStream> Client<S> {
|
||||
with_code!(result, [220].iter())
|
||||
}
|
||||
|
||||
/// Sends content to the server, after checking the command sequence, and then
|
||||
/// updates the transaction state
|
||||
/// Sends content to the server
|
||||
fn send_server(&mut self, content: &str, end: &str, expected_codes: Iter<u16>) -> SmtpResult {
|
||||
let result = self.stream.as_mut().unwrap().send_and_get_response(content, end);
|
||||
with_code!(result, expected_codes)
|
||||
|
||||
10
src/error.rs
10
src/error.rs
@@ -21,13 +21,13 @@ use self::ErrorKind::{TransientError, PermanentError, UnknownError, InternalIoEr
|
||||
/// An enum of all error kinds.
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
pub enum ErrorKind {
|
||||
/// Transient error
|
||||
/// Transient error, 4xx reply code
|
||||
///
|
||||
/// 4xx reply code
|
||||
/// [RFC 5321, section 4.2.1](https://tools.ietf.org/html/rfc5321#section-4.2.1)
|
||||
TransientError(Response),
|
||||
/// Permanent error
|
||||
/// Permanent error, 5xx reply code
|
||||
///
|
||||
/// 5xx reply code
|
||||
/// [RFC 5321, section 4.2.1](https://tools.ietf.org/html/rfc5321#section-4.2.1)
|
||||
PermanentError(Response),
|
||||
/// Unknown error
|
||||
UnknownError(String),
|
||||
@@ -74,7 +74,7 @@ impl FromError<Response> for SmtpError {
|
||||
_ => UnknownError(format! ("{:?}", response)),
|
||||
};
|
||||
let desc = match kind {
|
||||
TransientError(_) => "a permanent error occured during the SMTP transaction",
|
||||
TransientError(_) => "a transient error occured during the SMTP transaction",
|
||||
PermanentError(_) => "a permanent error occured during the SMTP transaction",
|
||||
UnknownError(_) => "an unknown error occured during the SMTP transaction",
|
||||
InternalIoError(_) => "an I/O error occurred",
|
||||
|
||||
@@ -42,7 +42,6 @@ pub enum Extension {
|
||||
}
|
||||
|
||||
impl Extension {
|
||||
// TODO: check RFC
|
||||
fn from_str(s: &str) -> Result<Vec<Extension>, &'static str> {
|
||||
let splitted : Vec<&str> = s.split(' ').collect();
|
||||
match (splitted[0], splitted.len()) {
|
||||
|
||||
13
src/lib.rs
13
src/lib.rs
@@ -7,12 +7,12 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! # Rust SMTP library
|
||||
//! # Rust SMTP client
|
||||
//!
|
||||
//! The client should tend to follow [RFC 5321](https://tools.ietf.org/html/rfc5321), but is still
|
||||
//! a work in progress.
|
||||
//!
|
||||
//! It may eventually implement the following extensions :
|
||||
//! It should eventually implement the following extensions :
|
||||
//!
|
||||
//! * 8BITMIME ([RFC 6152](https://tools.ietf.org/html/rfc6152))
|
||||
//! * SMTPUTF8 ([RFC 6531](http://tools.ietf.org/html/rfc6531))
|
||||
@@ -120,15 +120,8 @@
|
||||
//! let _ = email_client.quit();
|
||||
//! ```
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#![doc(html_root_url = "http://amousset.github.io/rust-smtp/smtp/")]
|
||||
|
||||
#![unstable]
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#![feature(plugin, core, old_io, io, collections)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
extern crate "rustc-serialize" as serialize;
|
||||
|
||||
Reference in New Issue
Block a user