- Issue created by @JCL324
- πΊπΈUnited States yujiman85
Any update on this? I'm having a very similar issue.
- π¨π¦Canada Jaypan
I just hit this issue in DDev. To configure this module to work with Mailpit in DDev, you can do the following:
- Navigate to Admin -> Configuration -> System -> Drupal Symfony Mailer Lite (Transport tab)
- Under Transport Type, select SMTP and click Add Transport
- Use the following settings:
Click save
- In the operations drop-down, click the arrow for the new Mailpit transport type, and select 'Set as default'
- Test and confirm
- Status changed to Closed: works as designed
about 1 year ago 11:51am 30 November 2023 - ππΊHungary mxr576 Hungary
This issue and especially this part just confirms to me that there is no one-transport-rule-them-all configuration on your project when every environment is different (local, QA, production).
I'm assuming that Native means whatever the OS is doing? But if I use the sendmail or msendmail option for that transport, I'm back to the same issues I had locally for sendmail.
Therefore I'd suggest registering multiple transports (#3 is also a valid transport config) and switching the default transport in
symfony_mailer_lite.settings
config in an environment-specific settings.php via config overrides. (I hope those are supported in your setup too.)This is what we did with Swiftmailer in the past and would do with this module and Drupal Symfony Mailer too.
- π§πͺBelgium flyke
Add this in your sites/default/settings.ddev.php if you are using SMTP transport:
// Override drupal/symfony_mailer_lite default config to use Mailpit $config['symfony_mailer_lite.symfony_mailer_lite_transport.smtp']['label'] = 'DDEV SMTP'; $config['symfony_mailer_lite.symfony_mailer_lite_transport.smtp']['plugin'] = 'smtp'; $config['symfony_mailer_lite.symfony_mailer_lite_transport.smtp']['configuration']['user']=''; $config['symfony_mailer_lite.symfony_mailer_lite_transport.smtp']['configuration']['pass']=''; $config['symfony_mailer_lite.symfony_mailer_lite_transport.smtp']['configuration']['host']='localhost'; $config['symfony_mailer_lite.symfony_mailer_lite_transport.smtp']['configuration']['port']='1025';
- π¦πΊAustralia dpi Perth, Australia
Just adding 2c since I was linked this, and following on @mxr576's #4:
Ive found creating all your transports as config, exporting them as normal works well.
Configure your default transport to use your local/development server.
Then, use env detection with env vars or whatever in a settings.php, switch the active transport via config overrides:$config['symfony_mailer_lite.settings']['default_transport'] = 'myprodtransportidgoeshere';
Keep in mind config overrides are not visible in the UI. So you can use
drush cget --include-overridden symfony_mailer_lite.settings
to verify your changes are active. - π¨πSwitzerland berdir Switzerland
@dpi: The default transport shown on the overview is actually considering the overridden value as it is not an edit form, it's loading it as regular immutable config with overrides. On the other site drush cget reads config directly and does not include overrides, if you want to see overrides, you need to use drush core-cli/drussh ev and then access it with \Drupal::config('symfony_mailer_lite.setting']->get().
- π¦πΊAustralia dpi Perth, Australia
The default transport shown on the overview is actually considering the overridden value as it is not an edit form
Ah okay, makes sense.
On the other site drush cget
Like I mentioned, the
--include-overridden
flag will include the overrides. - πΊπΈUnited States seanr
Confirmed I'm getting the overrides correct (we should be sending via smtp), but I'm still getting this:
An attempt to send an e-mail message failed, and the following error message was returned : Error creating transports: Unsupported sendmail command flags "/opt/mailhog/mhsendmail"; must be one of "-bs" or "-t" but can include additional flags.
drush @tcf.stage cget --include-overridden symfony_mailer_lite.settings _core: default_config_hash: EyOEXkLJD4vYGpK5wicdBSwBorOJgslf_tyscMgeN0Q default_transport: smtp
drush @tcf.stage cget --include-overridden symfony_mailer_lite.symfony_mailer_lite_transport.smtp uuid: e313ee9e-2ca1-42ea-ac39-a27bf2f56326 langcode: en status: true dependencies: { } id: smtp label: SMTP plugin: smtp configuration: user: '' pass: '' host: 127.0.0.1 port: '1025' query: verify_peer: false local_domain: '' restart_threshold: null restart_threshold_sleep: null ping_threshold: null
With swiftmailer on our staging server, it was 127.0.0.1, not localhost. Could that make a difference?