symfonyemailsmtppimcore

Issue while setting mailer in pimcore(symfony) :- Invalid configuration for path "framework.mailer": "dsn" and "transports" cannot be used together


Facing an issue with the mailer in pimcore 10.2 is made in symfony5.4. Invalid configuration for path "framework.mailer": "dsn" and "transports" cannot be used together. The setting I have done for the mail

# .env
MAILER_DSN=smtp://user:pass@smtp.example.com:port

# config/packages/mailer.yaml
framework:
    mailer:
        dsn: '%env(MAILER_DSN)%'

I didn't set any other mail transport.

#### SYMFONY MAILER TRANSPORTS
#    mailer:
#        transports:
#            main: smtp://user:pass@smtp.example.com:port
#            pimcore_newsletter: smtp://user:pass@smtp.example.com:port

Error gone when I remove mailer.yaml file. But then mail is not sending.


Solution

  • The problem was in mailer.yaml. It should be like

    # config/packages/mailer.yaml
    framework:
        mailer:
            transports:
                main: '%env(MAILER_DSN)%'