- Issue created by @shelane
- πΊπΈUnited States zengenuity
Thanks for your detailed report. Your log screenshot shows me we have a problem with the error logging. Can you apply the patch from this issue, and then test again?
https://www.drupal.org/project/symfony_mailer_lite/issues/3423916 π Error message is not included when transports can not be created Active
Also, is this on D10 or D9?
- πΊπΈUnited States shelane
After adding that patch, this is the error output in the log:
An attempt to send an e-mail message failed, and the following error message was returned : Error creating transports: Unsupported sendmail command flags "/usr/sbin/ssmtpwrapper 1ff848e3-0b70-415e-afeb-416903f6b26e llnl8 64c1a455-3dac-4205-b3b4-8d2e1f4a66a3 email-smtp.us-east-1.amazonaws.com 587 AKIAWSWCVJ4TPTZE6Y64 U2FsdGVkX18mep6cCkGbM2GI27QzA2Ib00dH1ucWPvTc9WUYLr2FMHgrNKIAS0MA2J5aMBylVXQopWb9QC3jVg## no-reply@acquia-mail.com arn:aws:ses:us-east-1:452453551910:identity/llnl.gov U2FsdGVkX19VUVkzd25Ddi7kLNyqMHglLGk9uPbX79l/OpkXriofG/3XTUg6OdCv 452453551910"; must be one of "-bs" or "-t" but can include additional flags.
This is Drupal 10.1.8 and PHP 8.2.11.
- πΊπΈUnited States zengenuity
Symfony Mailer library requires that either -t or -bs be in the sendmail command, if you choose the sendmail transport. It appears from your error message that the command is being altered before it gets passed to the library, and it no longer includes either of those.
Does it work if you use the Native transport instead?
- πΊπΈUnited States shelane
I set the default to Native and received the same error in the log. There is also a log entry for mail that says: Error sending email (from osc@xxx.xxx to french@xxx.xxx with reply-to not set). That error showed previously with the sendmail settings as well as the native transport.
- πΊπΈUnited States zengenuity
I see you changed the description to say that the issue was introduced between 1.0.1 and 1.0.2. That makes much more sense. We changed the way we instantiate the mailer and transports in that release: https://git.drupalcode.org/project/symfony_mailer_lite/-/commit/f1066b11...
I still don't know why this should cause Acquia email to fail. What I do see from your error message, though, is that they are totally replacing the sendmail command. You have entered "/usr/bin/sendmail -t", and but the error message says the command being run is "/usr/sbin/ssmtpwrapper XXXXXXX". That's the crux of the problem. The sendmail transport from Symfony Mailer library requires that a sendmail command have either a -t or a -bs, and their replacement does not have that. So, either they have to add one, or you have to use a different transport.
In the update from 1.0.1 to 1.0.2, we added the Drupal event dispatcher to the instance of the Mailer object from Symfony Mailer library, so that people could customize the transports to add authentication and other advanced features not supported by the module's UI. That may be what allows Acquia to change the command on versions > 1.0.1, and why it doesn't happen on earlier versions. But I'm not totally sure about that.
Could you go back to Acquia with this more detailed information and ask them what is injecting the /usr/sbin/ssmtpwrapper command into this transport? If there's something we can do to accommodate this command, I'm happy to add it. But, I don't really know enough about where it's coming from to fix it at this point.
Version 1.0.6, Drupal 9.5.4
I am seeing this error below, even though I had set the default transport to be SMTP. Seems like the system uses or checks the native transport (PHP native sendmail)?
An attempt to send an e-mail message failed, and the following error message was returned : Error creating transports: Unsupported sendmail command flags "C:\xampp\sendmail\sendmail.exe"; must be one of "-bs" or "-t" but can include additional flags.
- πΊπΈUnited States shelane
Acquia support worked to confirm this issue. This is what they worked out to get it to work, which I confirmed does work:
- Create a transport with Transport type as Sendmail
- Set Sendmail Command as /usr/sbin/sendmail -t
- Delete any other Transports. There must be only Sendmail transport
Note: he also found that if symfony_mailer is installed, it can interfere, but that is not installed on my site.
- πΊπΈUnited States shelane
The problem that I have found with this solution is that my local testing environment requires smtp for testing. Now I can't test sending email locally. This is important for testing things like upgrades to simplenews where it is vital that the email works.
- πΊπΈUnited States zengenuity
Do you have config split module on your site? If so, you could assign the SMTP transport configuration to a development split. Then, it would only be present in your local environment.
- πΊπΈUnited States zengenuity
I think you could also use Config Ignore module to ignore the local SMTP transport configuration.
- πΊπΈUnited States shelane
@zengenuity, you're absolutely right. I did a config split for local. Just a head slap moment for me.
- π«π·France atovik
For my use case, all my environments require SMTP (transactional emails).
The solution that worked for me:
- install the smtp module β (drupal/smtp)
- configure the new installed module (host, port, pass ,etc)
- configure the mailsystem module and for the Drupal Symfony Mailer Lite, change the sender to "SMTP mailer"
- clear the cache
- test sending emails
after doing this, Symfony mailer lite acts only as formatter, and smtp module as sender.
All my outging emails are correctly sent, and formatted.Hope that helps
- πΊπΈUnited States kerasai
Hi there, just curious if this is suspected to be an Acquia-only issue.
@kerasai
No, I had the same problem on a windows box with Xampp, and to solve it I had to edit the php.ini to set the flag for sendmail (even though I never use sendmail on this machine).- πΊπΈUnited States zengenuity
Just to clarify this, before closing this issue: This issue is Acquia-specific. They appear to be altering the symfony mailer transports at a platform level, and following the specific steps outlined in #9 avoids problems caused by this. Ideally they would document this better.
As for the other comments about sendmail not working in XAMPP or other dev environments: Everyone needs to understand the requirements for sending email from their chosen development or production environment. These requirements will not be the same between different environments, so what solves the problem for XAMPP is not going to fix your problem in DDEV or something else. Please don't blindly adopt the solutions provided by other commenters without understanding what you're doing.
Specifically to address the comment in #14 about installing the SMTP module: This module allows you to send with SMTP if you like. You just need to configure SMTP as your transport. I would not recommend combining the SMTP module and this module together. Not only is it redundant, but it could cause unpredictable problems in the future if the modules do things differently.
We have a solution to the original Acquia-specific problem, so I'm going to mark this as Fixed.
- Status changed to Fixed
7 months ago 2:19pm 12 April 2024 - πΊπΈUnited States shelane
And Acquia has now updated their documentation to specifically address this issue with this module on their platform with the outlined steps above.
https://docs.acquia.com/acquia-cloud-platform/manage-apps/platform-email...
Automatically closed - issue fixed for 2 weeks with no activity.