我正在学习本教程:
http://tutorial.symblog.co.uk/docs/validators-and-forms.html
在swift mailer部分,我没有在开发者栏中获得信封图标。我正在关注我的开发箱上的教程,所以它不会发送实际的电子邮件,因此我必须得到信封?
这是我的app / config / parameters.ini:
mailer_transport = "gmail"
mailer_encryption = "ssl"
mailer_auth_mode = "login"
mailer_host = "smtp.gmail.com"
mailer_user = "myemail@host.net"
mailer_password = "mypassword"
然后我有src / Blogger / BlogBundle / Controller / PageController.php:
public function contactAction()
{
#return $this->render('BloggerBlogBundle:Page:contact.html.twig');
$enquiry = new Enquiry();
$form = $this->createForm(new EnquiryType(), $enquiry);
$request = $this->getRequest();
if ($request->getMethod() == 'POST')
{
$form->bindRequest($request);
if ($form->isValid())
{
// Perform some action, such as sending an email
$message = \Swift_Message::newInstance()
->setSubject('Contact enquiry from symblog')
->setFrom('enquiries@symblog.co.uk')
->setTo($this->container->getParameter('blogger_blog.emails.contact_email'))
->setBody($this->renderView('BloggerBlogBundle:Page:contactEmail.txt.twig', array('enquiry' => $enquiry)));
$this->get('mailer')->send($message);
$this->get('session')->setFlash('blogger-notice', 'Your contact enquiry was successfully sent. Thank you!');
// Redirect - This is important to prevent users re-posting
// the form if they refresh the page
return $this->redirect($this->generateUrl('BloggerBlogBundle_contact'));
}
}
return $this->render('BloggerBlogBundle:Page:contact.html.twig', array(
'form' => $form->createView()
));
在此之后,我拥有他们所拥有的一切,我缺少什么?
请帮忙?
感谢
答案 0 :(得分:1)
您没有看到电子邮件图标,因为当前请求中没有发送电子邮件。
实际上,您在发送电子邮件后重定向用户,因此您在调试工具栏中看到的请求就是您发送电子邮件的请求之后的那个。
如果您想查看已发送的电子邮件,则必须进入探查器历史记录: