diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a8cde21..f447d86 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ ## Contributing to Lettre -The following guidelines are inspired from the [hyper project](https://github.com/hyperium/hyper/blob/master/CONTRIBUTING.md). +The following guidelines are inspired by the [hyper project](https://github.com/hyperium/hyper/blob/master/CONTRIBUTING.md). ### Code formatting diff --git a/SECURITY.md b/SECURITY.md index d5e45b1..ebf55df 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,7 +2,7 @@ The lettre project team welcomes security reports and is committed to providing prompt attention to security issues. Security issues should be reported privately via [security@lettre.rs](mailto:security@lettre.rs). Security issues -should not be reported via the public Github Issue tracker. +should not be reported via the public GitHub Issue tracker. ## Security advisories diff --git a/src/address/types.rs b/src/address/types.rs index c493f92..f18c84e 100644 --- a/src/address/types.rs +++ b/src/address/types.rs @@ -15,7 +15,7 @@ use idna::domain_to_ascii; /// /// This type contains email in canonical form (_user@domain.tld_). /// -/// **NOTE**: Enable feature "serde" to be able serialize/deserialize it using [serde](https://serde.rs/). +/// **NOTE**: Enable feature "serde" to be able to serialize/deserialize it using [serde](https://serde.rs/). /// /// # Examples /// diff --git a/src/message/attachment.rs b/src/message/attachment.rs index d91051d..8564518 100644 --- a/src/message/attachment.rs +++ b/src/message/attachment.rs @@ -13,9 +13,9 @@ pub struct Attachment { #[derive(Clone)] enum Disposition { - /// file name + /// File name Attached(String), - /// content id + /// Content id Inline(String), } diff --git a/src/message/dkim.rs b/src/message/dkim.rs index 646a089..6a4c577 100644 --- a/src/message/dkim.rs +++ b/src/message/dkim.rs @@ -144,19 +144,18 @@ impl DkimSigningKey { } /// A struct to describe Dkim configuration applied when signing a message -/// selector: the name of the key publied in DNS -/// domain: the domain for which we sign the message -/// private_key: private key in PKCS1 string format -/// headers: a list of headers name to be included in the signature. Signing of more than one -/// header with same name is not supported -/// canonicalization: the canonicalization to be applied on the message -/// pub signing_algorithm: the signing algorithm to be used when signing #[derive(Debug)] pub struct DkimConfig { + /// The name of the key published in DNS selector: String, + /// The domain for which we sign the message domain: String, + /// The private key in PKCS1 string format private_key: DkimSigningKey, + /// A list of header names to be included in the signature. Signing of more than one + /// header with the same name is not supported headers: Vec, + /// The signing algorithm to be used when signing canonicalization: DkimCanonicalization, } @@ -345,7 +344,7 @@ fn dkim_canonicalize_headers<'a>( } } -/// Sign with Dkim a message by adding Dkim-Signture header created with configuration expressed by +/// Sign with Dkim a message by adding Dkim-Signature header created with configuration expressed by /// dkim_config pub fn dkim_sign(message: &mut Message, dkim_config: &DkimConfig) { diff --git a/src/message/header/content_disposition.rs b/src/message/header/content_disposition.rs index 9bdb512..dfe97ad 100644 --- a/src/message/header/content_disposition.rs +++ b/src/message/header/content_disposition.rs @@ -22,7 +22,7 @@ impl ContentDisposition { } /// An attachment which should be displayed inline into the message, but that also - /// species the filename in case it were to be downloaded + /// species the filename in case it is downloaded pub fn inline_with_name(file_name: &str) -> Self { Self::with_name("inline", file_name) } diff --git a/src/message/header/content_type.rs b/src/message/header/content_type.rs index 05f6562..790eb2e 100644 --- a/src/message/header/content_type.rs +++ b/src/message/header/content_type.rs @@ -11,12 +11,12 @@ use crate::BoxError; /// `Content-Type` of the body /// -/// This struct can represent any valid [mime type], which can be parsed via +/// This struct can represent any valid [MIME type], which can be parsed via /// [`ContentType::parse`]. Constants are provided for the most-used mime-types. /// /// Defined in [RFC2045](https://tools.ietf.org/html/rfc2045#section-5) /// -/// [mime type]: https://www.iana.org/assignments/media-types/media-types.xhtml +/// [MIME type]: https://www.iana.org/assignments/media-types/media-types.xhtml #[derive(Debug, Clone, PartialEq, Eq)] pub struct ContentType(Mime); diff --git a/src/message/header/mod.rs b/src/message/header/mod.rs index 3f03beb..649efef 100644 --- a/src/message/header/mod.rs +++ b/src/message/header/mod.rs @@ -66,7 +66,7 @@ impl Headers { } } - /// Returns a copy of an `Header` present in `Headers` + /// Returns a copy of a `Header` present in `Headers` /// /// Returns `None` if `Header` isn't present in `Headers`. pub fn get(&self) -> Option { @@ -310,7 +310,7 @@ impl HeaderValue { /// acceptable for use if `encoded_value` contains only ascii /// printable characters and is already line folded. /// - /// When in doubt use [`HeaderValue::new`]. + /// When in doubt, use [`HeaderValue::new`]. pub fn dangerous_new_pre_encoded( name: HeaderName, raw_value: String, diff --git a/src/message/mailbox/serde.rs b/src/message/mailbox/serde.rs index 495929e..a73abdc 100644 --- a/src/message/mailbox/serde.rs +++ b/src/message/mailbox/serde.rs @@ -179,7 +179,7 @@ mod test { } #[test] - fn parse_mailbox_object_address_stirng() { + fn parse_mailbox_object_address_string() { let m: Mailbox = from_str(r#"{ "name": "Kai", "email": "kayo@example.com" }"#).unwrap(); assert_eq!(m, "Kai ".parse().unwrap()); } diff --git a/src/message/mailbox/types.rs b/src/message/mailbox/types.rs index 928b80e..7eacd80 100644 --- a/src/message/mailbox/types.rs +++ b/src/message/mailbox/types.rs @@ -15,7 +15,7 @@ use crate::address::{Address, AddressError}; /// /// This type contains email address and the sender/recipient name (_Some Name \_ or _withoutname@domain.tld_). /// -/// **NOTE**: Enable feature "serde" to be able serialize/deserialize it using [serde](https://serde.rs/). +/// **NOTE**: Enable feature "serde" to be able to serialize/deserialize it using [serde](https://serde.rs/). /// /// # Examples /// @@ -135,7 +135,7 @@ impl From
for Mailbox { /// /// This type contains a sequence of mailboxes (_Some Name \, Another Name \, withoutname@domain.tld, ..._). /// -/// **NOTE**: Enable feature "serde" to be able serialize/deserialize it using [serde](https://serde.rs/). +/// **NOTE**: Enable feature "serde" to be able to serialize/deserialize it using [serde](https://serde.rs/). #[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct Mailboxes(Vec); @@ -404,7 +404,7 @@ fn is_valid_atom_char(c: u8) -> bool { b'}' | b'~' | - // Not techically allowed but will be escaped into allowed characters. + // Not technically allowed but will be escaped into allowed characters. 128..=255) } diff --git a/src/message/mimebody.rs b/src/message/mimebody.rs index 51a202c..a78f7b0 100644 --- a/src/message/mimebody.rs +++ b/src/message/mimebody.rs @@ -100,14 +100,14 @@ impl SinglePart { SinglePartBuilder::new() } - /// Directly create a `SinglePart` from an plain UTF-8 content + /// Directly create a `SinglePart` from a plain UTF-8 content pub fn plain(body: T) -> Self { Self::builder() .header(header::ContentType::TEXT_PLAIN) .body(body) } - /// Directly create a `SinglePart` from an UTF-8 HTML content + /// Directly create a `SinglePart` from a UTF-8 HTML content pub fn html(body: T) -> Self { Self::builder() .header(header::ContentType::TEXT_HTML) @@ -149,17 +149,17 @@ impl EmailFormat for SinglePart { pub enum MultiPartKind { /// Mixed kind to combine unrelated content parts /// - /// For example this kind can be used to mix email message and attachments. + /// For example, this kind can be used to mix an email message and attachments. Mixed, /// Alternative kind to join several variants of same email contents. /// - /// That kind is recommended to use for joining plain (text) and rich (HTML) messages into single email message. + /// That kind is recommended to use for joining plain (text) and rich (HTML) messages into a single email message. Alternative, /// Related kind to mix content and related resources. /// - /// For example, you can include images into HTML content using that. + /// For example, you can include images in HTML content using that. Related, /// Encrypted kind for encrypted messages diff --git a/src/message/mod.rs b/src/message/mod.rs index de0a5b7..b0cee41 100644 --- a/src/message/mod.rs +++ b/src/message/mod.rs @@ -388,13 +388,13 @@ impl MessageBuilder { /// Keep the `Bcc` header /// - /// By default the `Bcc` header is removed from the email after + /// By default, the `Bcc` header is removed from the email after /// using it to generate the message envelope. In some cases though, /// like when saving the email as an `.eml`, or sending through /// some transports (like the Gmail API) that don't take a separate /// envelope value, it becomes necessary to keep the `Bcc` header. /// - /// Calling this method overrides the default behaviour. + /// Calling this method overrides the default behavior. pub fn keep_bcc(mut self) -> Self { self.drop_bcc = false; self @@ -630,7 +630,7 @@ mod test { } #[test] - fn email_miminal_message() { + fn email_minimal_message() { assert!(Message::builder() .from("NoBody ".parse().unwrap()) .to("NoBody ".parse().unwrap()) diff --git a/src/transport/smtp/async_transport.rs b/src/transport/smtp/async_transport.rs index f40cbb0..cfbf4e7 100644 --- a/src/transport/smtp/async_transport.rs +++ b/src/transport/smtp/async_transport.rs @@ -103,7 +103,7 @@ where .tls(Tls::Wrapper(tls_parameters))) } - /// Simple an secure transport, using STARTTLS to obtain encrypted connections + /// Simple and secure transport, using STARTTLS to obtain encrypted connections /// /// Alternative to [`AsyncSmtpTransport::relay`](#method.relay), for SMTP servers /// that don't take SMTPS connections. @@ -151,7 +151,7 @@ where /// /// * No authentication /// * No TLS - /// * A 60 seconds timeout for smtp commands + /// * A 60-seconds timeout for smtp commands /// * Port 25 /// /// Consider using [`AsyncSmtpTransport::relay`](#method.relay) or @@ -172,7 +172,7 @@ where /// Tests the SMTP connection /// /// `test_connection()` tests the connection by using the SMTP NOOP command. - /// The connection is closed afterwards if a connection pool is not used. + /// The connection is closed afterward if a connection pool is not used. pub async fn test_connection(&self) -> Result { let mut conn = self.inner.connection().await?; diff --git a/src/transport/smtp/authentication.rs b/src/transport/smtp/authentication.rs index a6b7b0d..83ea26f 100644 --- a/src/transport/smtp/authentication.rs +++ b/src/transport/smtp/authentication.rs @@ -51,7 +51,7 @@ pub enum Mechanism { /// [RFC 4616](https://tools.ietf.org/html/rfc4616) Plain, /// LOGIN authentication mechanism - /// Obsolete but needed for some providers (like office365) + /// Obsolete but needed for some providers (like Office 365) /// /// Defined in [draft-murchison-sasl-login-00](https://www.ietf.org/archive/id/draft-murchison-sasl-login-00.txt). Login, @@ -71,7 +71,7 @@ impl Display for Mechanism { } impl Mechanism { - /// Does the mechanism supports initial response + /// Does the mechanism support initial response? pub fn supports_initial_response(self) -> bool { match self { Mechanism::Plain | Mechanism::Xoauth2 => true, diff --git a/src/transport/smtp/client/async_connection.rs b/src/transport/smtp/client/async_connection.rs index 2aeaa19..2c530fb 100644 --- a/src/transport/smtp/client/async_connection.rs +++ b/src/transport/smtp/client/async_connection.rs @@ -132,7 +132,7 @@ impl AsyncSmtpConnection { mail_options.push(MailParameter::SmtpUtfEight); } - // Check for non-ascii content in message + // Check for non-ascii content in the message if !email.is_ascii() { if !self.server_info().supports_feature(Extension::EightBitMime) { return Err(error::client( @@ -226,7 +226,7 @@ impl AsyncSmtpConnection { self.command(Noop).await.is_ok() } - /// Sends an AUTH command with the given mechanism, and handles challenge if needed + /// Sends an AUTH command with the given mechanism, and handles the challenge if needed pub async fn auth( &mut self, mechanisms: &[Mechanism], diff --git a/src/transport/smtp/client/async_net.rs b/src/transport/smtp/client/async_net.rs index 44a7e87..284ae51 100644 --- a/src/transport/smtp/client/async_net.rs +++ b/src/transport/smtp/client/async_net.rs @@ -208,9 +208,9 @@ impl AsyncNetworkStream { timeout: Option, tls_parameters: Option, ) -> Result { - // Unfortunately there doesn't currently seem to be a way to set the local address + // Unfortunately, there doesn't currently seem to be a way to set the local address. // Whilst we can create a AsyncStd1TcpStream from an existing socket, it needs to first have - // connected which is a blocking operation. + // been connected, which is a blocking operation. async fn try_connect_timeout( server: T, timeout: Duration, diff --git a/src/transport/smtp/client/connection.rs b/src/transport/smtp/client/connection.rs index a72e646..b3dc62f 100644 --- a/src/transport/smtp/client/connection.rs +++ b/src/transport/smtp/client/connection.rs @@ -100,7 +100,7 @@ impl SmtpConnection { mail_options.push(MailParameter::SmtpUtfEight); } - // Check for non-ascii content in message + // Check for non-ascii content in the message if !email.is_ascii() { if !self.server_info().supports_feature(Extension::EightBitMime) { return Err(error::client( @@ -207,7 +207,7 @@ impl SmtpConnection { self.command(Noop).is_ok() } - /// Sends an AUTH command with the given mechanism, and handles challenge if needed + /// Sends an AUTH command with the given mechanism, and handles the challenge if needed pub fn auth( &mut self, mechanisms: &[Mechanism], diff --git a/src/transport/smtp/client/net.rs b/src/transport/smtp/client/net.rs index 2ad7145..37d9795 100644 --- a/src/transport/smtp/client/net.rs +++ b/src/transport/smtp/client/net.rs @@ -354,7 +354,7 @@ impl Write for NetworkStream { } /// If the local address is set, binds the socket to this address. -/// If local address is not set, then destination address is required to determine to the default +/// If local address is not set, then destination address is required to determine the default /// local address on some platforms. /// See: https://github.com/hyperium/hyper/blob/faf24c6ad8eee1c3d5ccc9a4d4835717b8e2903f/src/client/connect/http.rs#L560 fn bind_local_address( diff --git a/src/transport/smtp/client/tls.rs b/src/transport/smtp/client/tls.rs index 0fab24a..4894371 100644 --- a/src/transport/smtp/client/tls.rs +++ b/src/transport/smtp/client/tls.rs @@ -47,9 +47,9 @@ pub enum TlsVersion { Tlsv12, /// TLS 1.3 /// - /// The most secure option, altough not supported by all SMTP servers. + /// The most secure option, although not supported by all SMTP servers. /// - /// Altough it is technically supported by all TLS backends, + /// Although it is technically supported by all TLS backends, /// trying to set it for `native-tls` will give a runtime error. Tlsv13, } diff --git a/src/transport/smtp/extension.rs b/src/transport/smtp/extension.rs index 66e2af3..89fc299 100644 --- a/src/transport/smtp/extension.rs +++ b/src/transport/smtp/extension.rs @@ -190,7 +190,7 @@ impl ServerInfo { .contains(&Extension::Authentication(mechanism)) } - /// Gets a compatible mechanism from list + /// Gets a compatible mechanism from a list pub fn get_auth_mechanism(&self, mechanisms: &[Mechanism]) -> Option { for mechanism in mechanisms { if self.supports_auth_mechanism(*mechanism) { diff --git a/src/transport/smtp/response.rs b/src/transport/smtp/response.rs index ba8294b..403162b 100644 --- a/src/transport/smtp/response.rs +++ b/src/transport/smtp/response.rs @@ -19,7 +19,7 @@ use nom::{ use crate::transport::smtp::{error, Error}; -/// First digit indicates severity +/// The first digit indicates severity #[derive(PartialEq, Eq, Copy, Clone, Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Severity { diff --git a/src/transport/smtp/transport.rs b/src/transport/smtp/transport.rs index 07093ff..34b7c07 100644 --- a/src/transport/smtp/transport.rs +++ b/src/transport/smtp/transport.rs @@ -58,7 +58,7 @@ impl SmtpTransport { .tls(Tls::Wrapper(tls_parameters))) } - /// Simple an secure transport, using STARTTLS to obtain encrypted connections + /// Simple and secure transport, using STARTTLS to obtain encrypted connections /// /// Alternative to [`SmtpTransport::relay`](#method.relay), for SMTP servers /// that don't take SMTPS connections. @@ -95,7 +95,7 @@ impl SmtpTransport { /// /// * No authentication /// * No TLS - /// * A 60 seconds timeout for smtp commands + /// * A 60-seconds timeout for smtp commands /// * Port 25 /// /// Consider using [`SmtpTransport::relay`](#method.relay) or @@ -117,7 +117,7 @@ impl SmtpTransport { /// Tests the SMTP connection /// /// `test_connection()` tests the connection by using the SMTP NOOP command. - /// The connection is closed afterwards if a connection pool is not used. + /// The connection is closed afterward if a connection pool is not used. pub fn test_connection(&self) -> Result { let mut conn = self.inner.connection()?; @@ -194,7 +194,7 @@ impl SmtpTransportBuilder { /// Build the transport /// - /// If the `pool` feature is enabled an `Arc` wrapped pool is be created. + /// If the `pool` feature is enabled, an `Arc` wrapped pool is created. /// Defaults can be found at [`PoolConfig`] pub fn build(self) -> SmtpTransport { let client = SmtpClient { info: self.info };