Skip to content

Allow to use symfony/mailer and make the mailer service optionnal #2915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

tristanbes
Copy link

@tristanbes tristanbes commented Jun 4, 2019

Following this PR I cherry picked the commit making the mailer service optional and then I made possible to work with symfony/mailer

Right now, If you only have symfony/mailer on your >=4.3 project, you can't use FOSUserBundle because

Argument 1 passed to FOS\UserBundle\Mailer\TwigSwiftMailer::__construct() must be an instance of Swift_Mailer, instance of Symfony\Component\Mailer\Mailer given

Also, having both symfony/mailer and symfony/swiftmailer-bundle is not possible.

EDIT: In Symfony 4.3.1, they renamed the service id from mailer to mailer.mailer for the MailerInterface

->html($body);
}

if (class_exists('Swift_Mailer')) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems dangerous - yes you cant have swiftmailer-bundle AND symonfy/mailer - but you can have symfony/mailer AND swiftmailer (without the bundle.)

@louia
Copy link

louia commented Dec 18, 2019

FOSUserBundle always not working ?

@comur
Copy link

comur commented Apr 4, 2020

Hi,

I have the exact same problem. Did someone find a workaround ?

Thx

@stof
Copy link
Member

stof commented Apr 27, 2022

Closing this PR, as it is not the proper way of adding support for symfony/mailer, and the checks for mailers compatible with the configured fos_user.mailer service should not be removed.

@stof stof closed this Apr 27, 2022
@mpdude
Copy link

mpdude commented Mar 27, 2023

So #3042 is a … solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants