In our project, the signup process automatically logs in the user after registration like this:
$token = new UsernamePasswordToken($user, null, $firewallName, $user->getRoles());
$this->get('security.context')->setToken($token);
Which works just fine unless we also send an email in the same action.
For emails we are using swiftmailer.
Can anyone shed some light on this? Why does this happen? What can I do to keep the user logged, and also send the email?