symfony / swiftmailer-bundle

Symfony Swiftmailer Bundle
https://symfony.com/swiftmailer-bundle
MIT License
1.56k stars 151 forks source link

Custom sendmail command is not being processed if there are no link to .env file #244

Closed ArchieDoe closed 5 years ago

ArchieDoe commented 6 years ago

In config/packages/swiftmailer.yaml next config

swiftmailer:
    transport: 'sendmail'
    command: '/usr/bin/msmtp -t -i'

will not be interpreted properly: command property will be omitted.

This happens because of next code:

if ($usedEnvs && !$disableDelivery) {
    // Factory sets here.
}

In case of configuration above $usedEnvs is always empty, which requires to store some information in .env file.

kojidev commented 5 years ago

I agree that condition is rather odd. The whole SwiftmailerExtension and SwiftmailerTransportFactory are quite difficult to understand. At one point we are checking that that there's no env vars and configuring transport using a factory, otherwise we use configureMailerTransport method, which seemingly does the same.

UPD.: Here's a guy suffers from the same weird design: https://github.com/symfony/swiftmailer-bundle/issues/217, so and I did.

Toflar commented 5 years ago

I just had the same issue and imho it's not even related to environment vars. The command is just ignored completely. You may check my PR (https://github.com/symfony/swiftmailer-bundle/pull/286) and provide feedback if that fixes it for you.