A few spelling and doc fixes (#900)

This commit is contained in:
Alexis Mousset
2023-08-16 21:56:33 +02:00
committed by GitHub
parent b5652f18b7
commit bbab86b484
22 changed files with 49 additions and 50 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
///

View File

@@ -13,9 +13,9 @@ pub struct Attachment {
#[derive(Clone)]
enum Disposition {
/// file name
/// File name
Attached(String),
/// content id
/// Content id
Inline(String),
}

View File

@@ -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<HeaderName>,
/// 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) {

View File

@@ -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)
}

View File

@@ -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);

View File

@@ -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<H: Header>(&self) -> Option<H> {
@@ -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,

View File

@@ -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 <kayo@example.com>".parse().unwrap());
}

View File

@@ -15,7 +15,7 @@ use crate::address::{Address, AddressError};
///
/// This type contains email address and the sender/recipient name (_Some Name \<user@domain.tld\>_ 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<Address> for Mailbox {
///
/// This type contains a sequence of mailboxes (_Some Name \<user@domain.tld\>, Another Name \<other@domain.tld\>, 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<Mailbox>);
@@ -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)
}

View File

@@ -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<T: IntoBody>(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<T: IntoBody>(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

View File

@@ -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 <nobody@domain.tld>".parse().unwrap())
.to("NoBody <nobody@domain.tld>".parse().unwrap())

View File

@@ -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<bool, Error> {
let mut conn = self.inner.connection().await?;

View File

@@ -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,

View File

@@ -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],

View File

@@ -208,9 +208,9 @@ impl AsyncNetworkStream {
timeout: Option<Duration>,
tls_parameters: Option<TlsParameters>,
) -> Result<AsyncNetworkStream, Error> {
// 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<T: AsyncStd1ToSocketAddrs>(
server: T,
timeout: Duration,

View File

@@ -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],

View File

@@ -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(

View File

@@ -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,
}

View File

@@ -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<Mechanism> {
for mechanism in mechanisms {
if self.supports_auth_mechanism(*mechanism) {

View File

@@ -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 {

View File

@@ -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<bool, Error> {
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 };