I installed symfony2 and FOSUserBundle. Both are working correctly, however when I access the registration page of FOSUserBundle, which is using SwiftMailer as for email confirmation I get the following error instantly.
Fatal error: Class 'Swift_Mailer' not found in /home/public_html/cache/dev/appDevDebugProjectContainer.php on line 1331
Line 1331 has the following code:
return $this->services['mailer'] = new \Swift_Mailer($this->get('swiftmailer.transport'));
In the debug information, I see SwiftMailerBundle is correctly loaded. Now I'm stuck, I have been struggling with this for quite some time and I'm not familiar with Symfony just yet. Pretty sure it's my shortcoming, but a pair of fresh eyes will help. Am I missing something, is this something configurable? The Swift\Mailer class is actually on the server, located under vendor/swiftmailer/swiftmailer/lib/classes/swift/mailer.php
anyone can help with this? Thanks a lot!
Can you check whether you have these lines in your app\autoload.php:
// Swiftmailer needs a special autoloader to allow
// the lazy loading of the init file (which is expensive)
require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php';
Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php');