Learn how to solve and learn why this error happens while you try to implement FOSUserBundle in a new project.

FOSUserBundle: the child node "from_email" at path "fos_user" must be configured

With the latest version of Symfony and FOSUserBundle a lot of developers have faced this exception. It happens because now the from_email node is obligatory. The FOSUserBundle has built-in support for sending emails in two different instances. These values cannot be null, so if you try to set the value of these properties either with "" or ~, the problem will persist. The FOSUserBundle default mailer allows you to configure the sender email address of the emails sent out by the bundle. You can configure the address globally or on a per email basis. To configure the sender email address for all emails sent out by the bundle and in your app, simply update your fos_user config in the config.yml file as follows:

# /app/config.yml
fos_user:
    ## Your configuration for FOS
    db_driver: orm
    firewall_name: main
    user_class: userBundle\Entity\User
    group:
        group_class: userBundle\Entity\Group
    
    ## To solve the problem
    from_email:
        address: "[email protected]"
        sender_name: "No Reply"

Solution

Provide the required parameters (address and sender_name) of the from_email node even if you don't use them (set dummy values):

# /app/config.yml
fos_user:
    from_email:
        address: "[email protected]"
        sender_name: "Demo String"

In case that you need more information about the usage of Emails in FOSUserBundle, please refer to the official documentation here.

Happy coding !


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors