Skip to content

Commit 363d251

Browse files
committed
fix: Simplify envelope sender handling conditional plus better spotting for -f
1 parent de41932 commit 363d251

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/wp-includes/pluggable.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,8 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
445445

446446
try {
447447
// This block should be removed once PHPMailer supports setting the envelope sender separately.
448-
$sendmail_path = ini_get( 'sendmail_path' );
449-
if ( str_contains( $sendmail_path, '-f' ) ) {
450-
$phpmailer->setFrom( $from_email, $from_name, false );
451-
} else {
452-
$phpmailer->setFrom( $from_email, $from_name );
453-
}
448+
$auto = ! str_contains( $sendmail_path, ' -f' );
449+
$phpmailer->setFrom( $from_email, $from_name, $auto );
454450
} catch ( PHPMailer\PHPMailer\Exception $e ) {
455451
$mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
456452
$mail_error_data['phpmailer_exception_code'] = $e->getCode();

0 commit comments

Comments
 (0)