Search code examples
symfonysslhttpsfosuserbundleswiftmailer

Symfony FOSUserBundle https in mails


Symfony 3.4. I have a problem with forcing mailer use only https with URLs in mail such as activation/forgot password mail from FOSBundle, example:

message: |
Hello %username%!

To finish activating your account - please visit %confirmationUrl%

This link can only be used once to validate your account.

Regards,
the Team. 

is there way to force mailer use https for %confirmationUrl% and others? Thanks!


Solution

  • Force the routes -that are used to generate full URL's- to https. See this page.

    To do that you will have to add your own version of the fosuserbundle routing. You can find the routing files here.

    Copy them to your src/AppBundle/Resources/config bundle directory and edit them to make them force https and change app/config/routing.yml to include your own files