Am using swift mailer to send emails for my symfony application.But it is throwing the error: There is no extension able to load the configuration for "transport". I am getting the error when it loads the configuration file the app is crashed. Please help me to know how can I exact define it's configuration parameters. My app/config.yml is like:
swiftmailer:
transport: gmail
username: '[email protected]'
password: 'Mypassword'
I have also checked app/Appkernel.php swiftmailer bundle is already registered:
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new Acme\SuperbAppBundle\AcmeSuperbAppBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
Am using the following code to send email:
$message = \Swift_Message::newInstance()
->setSubject('Hello Email') // we configure the title
->setFrom('[email protected]') // we configure the sender
->setTo('[email protected]') // we configure the recipient
->setBody("Hello User");
$send = $this->get('mailer')->send($message); // then we send the message.