SwiftmailerBundle Configuration (“swiftmailer”)

This reference document is a work in progress. It should be accurate, but all options are not yet fully covered. For a full list of the default configuration options, see Full Default Configuration

The swiftmailer key configures Symfony’s integration with Swiftmailer, which is responsible for creating and delivering email messages.



type: string default: smtp

The exact transport method to use to deliver emails. Valid values are:


type: string

The username when using smtp as the transport.


type: string

The password when using smtp as the transport.


type: string default: localhost

The host to connect to when using smtp as the transport.


type: string default: 25 or 465 (depending on encryption)

The port when using smtp as the transport. This defaults to 465 if encryption is ssl and 25 otherwise.


type: string

The encryption mode to use when using smtp as the transport. Valid values are tls, ssl, or null (indicating no encryption).


type: string

The authentication mode to use when using smtp as the transport. Valid values are plain, login, cram-md5, or null.


For details on email spooling, see How to Spool Email.


type: string default: file

The method used to store spooled messages. Currently only file is supported. However, a custom spool should be possible by creating a service called swiftmailer.spool.myspool and setting this value to myspool.


type: string default: %kernel.cache_dir%/swiftmailer/spool

When using the file spool, this is the path where the spooled messages will be stored.


type: string

If set, all messages will be delivered with this address as the “return path” address, which is where bounced messages should go. This is handled internally by Swiftmailer’s Swift_Plugins_ImpersonatePlugin class.



type: string default: 99

Used with Swift_Plugins_AntiFloodPlugin. This is the number of emails to send before restarting the transport.


type: string default: 0

Used with Swift_Plugins_AntiFloodPlugin. This is the number of seconds to sleep for during a transport restart.


type: string

If set, all email messages will be sent to this address instead of being sent to their actual recipients. This is often useful when developing. For example, by setting this in the config_dev.yml file, you can guarantee that all emails sent during development go to a single account.

This uses Swift_Plugins_RedirectingPlugin. Original recipients are available on the X-Swift-To, X-Swift-Cc and X-Swift-Bcc headers.


type: Boolean default: false

If true, the transport will automatically be set to null, and no emails will actually be delivered.


type: Boolean default: %kernel.debug%

If true, Symfony’s data collector will be activated for Swiftmailer and the information will be available in the profiler.

Full Default Configuration

  • YAML
        transport:            smtp
        username:             ~
        password:             ~
        host:                 localhost
        port:                 false
        encryption:           ~
        auth_mode:            ~
            type:                 file
            path:                 "%kernel.cache_dir%/swiftmailer/spool"
        sender_address:       ~
            threshold:            99
            sleep:                0
        delivery_address:     ~
        disable_delivery:     ~
        logging:              "%kernel.debug%"