1

I have fresh installation of Symfony 5.4. I have followed the documentation in order to send email from my own smtp server but couldn't make it work. So, I'm trying https://mailtrap.io/ with the following configurations with no luck. Any help is appreciated.

Steps followed

composer require symfony/mailer
composer require symfonycasts/verify-email-bundle

MAILER_DSN=smtp://d62b667a28d6af:023c577a51bb51@smtp.mailtrap.io:2525 #MAILER_DSN=smtp://d62b667a28d6af:023c577a51bb51@smtp.mailtrap.io:2525?encryption=tls&auth_mode=login

RegistrationController

       ...

        // generate a signed url and email it to the user
        $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
            (new TemplatedEmail())
                ->from(new Address('registration@my_host.com', 'Registration Confirmation'))
                ->to($user->getEmail())
                ->subject('Please Confirm your Email')
                ->htmlTemplate('registration/confirmation_email.html.twig')
        );

mailer.yml

framework:
    mailer:
        dsn: '%env(MAILER_DSN)%'
Solomon Tesfaye
  • 186
  • 2
  • 10

4 Answers4

3

run composer require symfony/messenger then run php bin/console messenger:consume async

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 07 '22 at 00:46
1

If you installed Symfony with the --docker option, then your docker-compose.override.yml file will contain a configuration for a mail catcher when you add symfony mailer.

From the official Symfony website: https://symfony.com/doc/current/the-fast-track/en/3-zero.html

--docker: On your local machine, we will use Docker to manage services like PostgreSQL. This option enables Docker so that Symfony will automatically add Docker services based on the required packages (a PostgreSQL service when adding the ORM or a mail catcher when adding Symfony Mailer for instance).

In your Profiler bar, hover over "Server" to reveal an array of options one of which is Webmail. Your webmail will be getting delivered there if the configuration described above exists in your project.

Martin Fall
  • 121
  • 7
0

Make sure that you are not behind firewall that block the port you are using. In this case, port 2525.

Solomon Tesfaye
  • 186
  • 2
  • 10
0

run composer require symfony/messenger then run php bin/console messenger:consume async