"-t" mode not supported and also BCC not working

Created on 16 March 2023, over 1 year ago
Updated 5 December 2023, 12 months ago

Problem/Motivation

We are using SymfonyMailer module with transport as Sendmail with "-t" mode. To use -t mode, added below setting

$settings['mailer_sendmail_commands'] = ['/usr/sbin/sendmail -t'];

Version: https://www.drupal.org/project/symfony_mailer/releases/1.2.0

"drupal/symfony_mailer": "^1.2"

Issues:

  1. -t with sendmail is not supported in symfony mailer.
    https://github.com/symfony/mailer/blob/v6.2.7/Transport/SendmailTranspor...
  2. Recipients converted into command line args without specifying type of address (TO, CC, BCC)
  3. BCC address is missing in message headers.
    BCC was configured in the policy while using Test form
    	X-Mailer: Drupal
    	Subject: Test email from site
    	Sender: from-email@example.com
    	To: to-email@example.com
    	Cc: cc-email@example.com
    	Message-ID: <some-id>
    	From: from-email@example.com
    	MIME-Version: 1.0
    	Date: Tue, 14 Mar 2023 11:33:51 +0000
    	Content-Type: multipart/alternative; boundary=kMvrv4rr
    	
  4. Last param is treated as "TO" address by sendmail command, but sequence is being changed by module causing incorrect behaviour by sendmail.

expected:

/usr/sbin/sendmail -t 

actual:

/usr/sbin/sendmail -ffrom-email@example.com to-email@example.com cc-email@example.com bcc-email@example.com

From above command its not possible to understand which email address is for which category(TO, CC, BCC) without specifying its flag/option.

Steps to reproduce

  • Use test section of SymfonyMailer module: https:///admin/config/system/mailer/test
  • Configure policy by adding To, CC and BCC addresses
  • Send
  • Enable debugger to check the sendmail command
  • verify email is received or not for each address: To, CC, BCC.

Proposed resolution

  1. -t mode is supported
  2. BCC email address is present in the headers section

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: works as designed

Version

1.2

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dev-niraj
  • 🇬🇧United Kingdom adamps

    The code you link to is from Symfony mailer library - it's not part of this module. So there's nothing we can do about it here you need to raise an issue with the library.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇷🇴Romania ally.daliran

    Have you reviewed the comment from Symfony\Component\Mailer\Transport\SendmailTransport? It states:

    * Supported modes are -bs and -t, with any additional flags desired.
    *
    * The recommended mode is "-bs" since it is interactive and failure notifications are hence possible.
    * Note that the -t mode does not support error reporting and does not support Bcc properly (the Bcc headers are not removed).
    *
    * If using -t mode, you are strongly advised to include -oi or -i in the flags (like /usr/sbin/sendmail -oi -t)
    *
    * -f flag will be appended automatically if one is not present.

    In light of this information, particularly the recommendation for using the "-bs" mode for its interactivity and failure notification capability, you might consider revising the $settings['mailer_sendmail_commands'] in the Drupal settings configuration. If you prefer to use the "-t" mode despite its limitations in error reporting and handling of Bcc, you should include the '-oi' or '-i' flags for better operation. Thus, the settings would be modified to:

    $settings['mailer_sendmail_commands'] = [
      '/usr/sbin/sendmail -t -i',
    ];
Production build 0.71.5 2024