在symfony中发送swiftmailer的电子邮件

I am devolping the application in symfony.I have use the swiftmailer for sending emails.But the mail is not recieved. I dont know where I wrong. Here is my code:

$message = \Swift_Message::newInstance()
                    ->setSubject('Password Reset')
                    ->setFrom('support@bwcmultimedia.com')
                    ->setTo('karank@ocodewire.com')
                    ->setBody($this->renderView('DRPRegistrarGeneralBundle:Email:k.txt.twig'));
                $mailStatus = $this->get('mailer')->send($message);

I have set the parameters.yml file:

 database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: null
    database_name: database
    database_user: user
    database_password: pass
    mailer_transport: smtp
    mailer_encryption: 
    mailer_auth_mode: "login"
    mailer_host: smtp.gmail.com
    mailer_port: 25
    mailer_user: karansofat89@gmail.com
    mailer_password: pass
    locale: en
    secret: ThisTokenIsNotSoSecretChangeIt

Config file:

swiftmailer:
    transport: %mailer_transport%
    encryption: tls
    auth_mode: login
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%

Please help

For sending emails through gmail, you could set the mailer_transport to gmail and ommit the port.

parameters.yml

mailer_transport: gmail
mailer_encryption: ssl
mailer_auth_mode: login
mailer_host: smtp.gmail.com
mailer_user: karansofat89@gmail.com
mailer_password: pass

config.yml

swiftmailer:
    transport:  %mailer_transport%
    encryption: %mailer_encryption%
    auth_mode:  %mailer_auth_mode%
    host:       %mailer_host%
    username:   %mailer_user%
    password:   %mailer_password%

You should also make sure that the openssl extension is enabled.