Skip to content

The service "fos_user.mailer" has a dependency on a non-existent service "mailer" #2600

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
RobertRajcool opened this issue Aug 18, 2017 · 6 comments

Comments

@RobertRajcool
Copy link

RobertRajcool commented Aug 18, 2017

fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: UserBundle\Entity\User
    from_email:
        address: 'mail.redington.co.in'
        sender_name: 'cloudsupport'
@broiniac
Copy link

Hi there! What version of Symfony and FOSUserBundle are you using?

On freshly installed SF3.3 with Flex i had to set:

fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: App\Entity\User
    from_email:
        address: '%env(MAILER_USER_ADDRESS)%'
        sender_name: '%env(MAILER_USER_NAME)%'
    service:
        mailer: 'fos_user.mailer.noop'
        # mailer: 'fos_user.mailer.twig_swift' # Works as well

to quite this error. It didn't however remove the problem.

Does your SwiftmailerBundle is properly configured?

@RobertRajcool
Copy link
Author

without Swiftmailer bundle we can't use latest version ??

@broiniac
Copy link

broiniac commented Sep 4, 2017

Sorry, my fault. SwiftmailerBundle is not required, but swiftmailer (library) is.

https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/composer.json#L35

How about your setup? What version of Symfony do you use? And how about flex? Did you try use 'fos_user.mailer.twig_swift' as in my snippet?

Cheers!

EDIT:
On the other hand, FOSUserBundle documentations says (in boxed paragraph):
https://symfony.com/doc/master/bundles/FOSUserBundle/emails.html#default-mailer-implementations

The fos_user.mailer.noop mailer service should be used in the case where you do not want the bundle to send emails and you do not want to include the SwiftmailerBundle in your app. If you leave the default implementation configured as the mailer and do not have the SwiftmailerBundle registered, you will receive an exception because of a missing dependency.

So maybe SwiftmailerBundle is required after all?

@RobertRajcool
Copy link
Author

symfony:2.8.2,after install swiftmailerbundle its working fine.
but remove swiftmailerbundle its asking The service "fos_user.mailer" has a dependency on a non-existent service "mailer"

@broiniac
Copy link

broiniac commented Sep 5, 2017

So here is our answer :)

As far as I know you can write your own mailer and get rid of SwiftmailerBundle:
https://symfony.com/doc/master/bundles/FOSUserBundle/emails.html#using-a-custom-mailer

@RobertRajcool
Copy link
Author

@broiniac thanks a lot

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

No branches or pull requests

2 participants