I'm trying to send emails from my Symfony 3 project at Platform.sh.
I followed this documentation: https://docs.platform.sh/administration/web/email.html
My parameters.yml:
mailer_transport: sendmail
mailer_host: null
mailer_user: null
mailer_password: null
mailer_port: 465
mailer_encryption: tls
I use swiftmailer with memory spooling. Swiftmailer's send() method returns true, but it seems like it doesn't relly send any emails.
In the settings, outgoing emails are ON for Master.
Do I need to set any system variables, or what am I missing?
Using the Drupal Symfony Mailer module on a Drupal 9 or 10 website I had to override the sendmail transport command to use the -t option instead of the default -bs. Note that Sendmail documentation recommends using the -i or -oi options any time you use the -t option.
// sites/default/settings.platformsh.php
// Required for Sendgrid (via msmtp intercept from sendmail) on Platform.sh.
$config['symfony_mailer.mailer_transport.sendmail']['configuration']['query']['command'] = ini_get('sendmail_path') . ' -t -i';
For the (now deprecated) SwiftMailer for Drupal 8/9, you must set the transport_mode to 't' instead of 'bs'
# swiftmailer.transport.yml
sendmail_mode: 't'
Another possibility is to use platformsh environment variables.
d8config:swiftmailer.transport:sendmail_mode
and set its value to 't'
Hopefully it could help you on Symfony too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With