1

The local Development Machine uses msmtp for sending Mails, which works fine. BUT it does not accept /usr/sbin/sendmail -bs, it only works with /usr/sbin/sendmail -t. I can see that I could change this when using other parameters for the SendmailTransport constructor, but actually I never create an Instance of SendmailTransport - the consumer of the Messenger does this all alone.

How can I change the Sendmail Parameters when using async Mails via Messenger?

yivi
  • 42,438
  • 18
  • 116
  • 138
  • I don't see how the Symfony Messenger is in anyway related. It will use whatever configuration it's in use for Symfony Mailer. – yivi Mar 18 '20 at 14:26
  • Yes, but at the moment i would guess that you can't switch from -bs to -t via Configuration –  Mar 18 '20 at 14:40

1 Answers1

0

MessageHandler receives a TransportInterface as a dependency in order to send the messages, so indeed you can change it via configuration. Since once messenger is installed all messages will be sent with it, you can just override the default transport directly and it will be injected into the Handler:

# config/services_dev.yaml
services:
    Symfony\Component\Mailer\Transport\TransportInterface: 
        class: Symfony\Component\Mailer\Transport\SendmailTransport
        arguments:
            - '/usr/sbin/sendmail -t'
msg
  • 7,863
  • 3
  • 14
  • 33