Symfony Swiftmail 与雅虎一起使用
Symfony Swiftmail use with yahoo
我想发送一封带有 Symfony SwiftMail 和 Gandi (roundcube) 地址的电子邮件。
问题是什么也没发生,我不知道为什么。 ^^
config.yml
swiftmailer:
transport: mail
encryption: ssl
auth_mode: login
host: smtp
username: 'my email'
password: 'my mdp'
parametres.yml
parameters:
mailer_transport: smtp
mailer_host: 127.0.0.1:160
mailer_user: null
mailer_password: null
控制器:
public function contactAction()
{
$mail = "mymail";
$enquiry = new Contact();
$form = $this->createForm(new EnquiryType(), $enquiry);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
$data = $form->getData();
$message = \Swift_Message::newInstance()
->setContentType('text/html')
->setSubject($data->getSubject())
->setFrom($data->getAdresse())
->setTo($mail)
->setBody($data->getMessage());
$this->get('mailer')->send($message);
return $this->redirect($this->generateUrl('st_contact_homepage'));
}
return $this->render('STCommonBundle:Default:contact.html.twig', array('form' => $form->createView()));
}
你能帮帮我吗?
谢谢。 ^^
你的配置似乎有误
"host" 属性 必须是 smpt 主机名
喜欢
smpt.yahoo.com
你需要找出来
并且传输是 smpt
太像了:
swiftmailer:
transport: smtp
encryption: ssl
auth_mode: login
host: smtp.yahoo.com
username: 'my email'
password: 'my mdp'
我想发送一封带有 Symfony SwiftMail 和 Gandi (roundcube) 地址的电子邮件。 问题是什么也没发生,我不知道为什么。 ^^
config.yml
swiftmailer:
transport: mail
encryption: ssl
auth_mode: login
host: smtp
username: 'my email'
password: 'my mdp'
parametres.yml
parameters:
mailer_transport: smtp
mailer_host: 127.0.0.1:160
mailer_user: null
mailer_password: null
控制器:
public function contactAction()
{
$mail = "mymail";
$enquiry = new Contact();
$form = $this->createForm(new EnquiryType(), $enquiry);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bind($request);
$data = $form->getData();
$message = \Swift_Message::newInstance()
->setContentType('text/html')
->setSubject($data->getSubject())
->setFrom($data->getAdresse())
->setTo($mail)
->setBody($data->getMessage());
$this->get('mailer')->send($message);
return $this->redirect($this->generateUrl('st_contact_homepage'));
}
return $this->render('STCommonBundle:Default:contact.html.twig', array('form' => $form->createView()));
}
你能帮帮我吗?
谢谢。 ^^
你的配置似乎有误
"host" 属性 必须是 smpt 主机名
喜欢
smpt.yahoo.com
你需要找出来
并且传输是 smpt
太像了:
swiftmailer:
transport: smtp
encryption: ssl
auth_mode: login
host: smtp.yahoo.com
username: 'my email'
password: 'my mdp'