我无法使用 symfony2 发送电子邮件
应用程序/配置/config.yml
swiftmailer:
transport: smtp
encryption: ssl
auth_mode: login
host: smtp.gmail.com
username: mymail@gmail.com
password: mypassword
src/Ga/CmsBundle/Resources/config/routing.yml
emailing:
pattern: /emailing
defaults: { _controller: "GaCmsBundle:main:emailing" }
src/Ga/CmsBundle/Controller/mainController.php
public function emailingAction()
{
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('mymail@gmail.com')
->setTo('anothermail@yahoo.com')
->setBody('mahdi musawie');
$this->get('mailer')->send($message);
return new response("mahdi");
}