Skip to content

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

Closed
tristanbes wants to merge 4 commits into
FriendsOfSymfony:masterfrom
tristanbes:master
Closed

tristanbes wants to merge 4 commits into
FriendsOfSymfony:masterfrom
tristanbes:master

Conversation

@tristanbes

@tristanbes tristanbes commented Jun 4, 2019 •

Copy link
Copy Markdown

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

Comment thread Mailer/Mailer.php
->html($body);
}

if (class_exists('Swift_Mailer')) {

Copy link
Copy Markdown

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

louia commented Dec 18, 2019

Copy link
Copy Markdown

FOSUserBundle always not working ?

@comur

comur commented Apr 4, 2020

Copy link
Copy Markdown

Hi,

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

Thx

@stof

stof commented Apr 27, 2022

Copy link
Copy Markdown
Member

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

mpdude commented Mar 27, 2023

Copy link
Copy Markdown

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