Showing posts with label swiftmailer. Show all posts
Showing posts with label swiftmailer. Show all posts

Saturday, February 9, 2013

Symfony 2 SwiftMailer Spoof and Redirect Response Abnormal behavior

Specs:
  • Symfony 2.1.x
  • FOSUserBundle
  • SwiftMailer
I was trying to modify the registration flow in FOSUserBundle to do two things:
  • After a user registers, he/she will be logged in automatically (no need to confirm emails)
  • Send an email to the user upon successful registration
However, I find that after the user registers, he/she is always redirected to the login page (I want them to be in an authenticated page). If the user refreshes this page (via the refresh button in the browser), they would be logged in.

After numerous hours of debugging, I found that if I turn off the memory spooling option in SwiftMailer, everything would work fine.

In app/config/config.yaml
swiftmailer:
    transport: %mailer_transport%
    encryption: %encryption%
    auth_mode: login
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%
    #spool:     { type: memory }
If anyone knows why this is happening, please comment below.