fix(transport): Use the sendmail command in PATH by default (#682)

This will allow the transport to work with default settings on more systems,
while preserving the ability to use a specific binary.
This commit is contained in:
Alexis Mousset
2021-10-16 09:49:45 +02:00
committed by GitHub
parent dc9c5df210
commit 8f28b0c341
2 changed files with 11 additions and 4 deletions

View File

@@ -31,7 +31,8 @@ Several breaking changes were made between 0.9 and 0.10, but changes should be s
* When the hostname feature is disabled or hostname cannot be fetched, `127.0.0.1` is used instead of `localhost` as EHLO parameter (for better RFC compliance and mail server compatibility)
* The `new` method of `ClientId` is deprecated
* Rename `serde-impls` feature to `serde`
* The `SendmailTransport` now uses the `sendmail` command in current `PATH` by default instead of
`/usr/bin/sendmail`.
#### Bug Fixes

View File

@@ -92,7 +92,7 @@ use std::{
mod error;
const DEFAULT_SENDMAIL: &str = "/usr/sbin/sendmail";
const DEFAULT_SENDMAIL: &str = "sendmail";
/// Sends emails using the `sendmail` command
#[derive(Debug, Clone)]
@@ -113,7 +113,10 @@ pub struct AsyncSendmailTransport<E: Executor> {
}
impl SendmailTransport {
/// Creates a new transport with the default `/usr/sbin/sendmail` command
/// Creates a new transport with the `sendmail` command
///
/// Note: This uses the `sendmail` command in the current `PATH`. To use another command,
/// use [SendmailTransport::new_with_command].
pub fn new() -> SendmailTransport {
SendmailTransport {
command: DEFAULT_SENDMAIL.into(),
@@ -147,7 +150,10 @@ impl<E> AsyncSendmailTransport<E>
where
E: Executor,
{
/// Creates a new transport with the default `/usr/sbin/sendmail` command
/// Creates a new transport with the `sendmail` command
///
/// Note: This uses the `sendmail` command in the current `PATH`. To use another command,
/// use [AsyncSendmailTransport::new_with_command].
pub fn new() -> Self {
Self {
inner: SendmailTransport::new(),