我遇到了一個非常奇怪的問題。我通過我的網站發送電子郵件給其他收件人。在symfony中,我對此非常陌生。這裏是我的代碼爲什麼smtp服務器不再發送電子郵件?
confg.yml
這裏是我的表格功能
public function formemailAction(Request $request)
{
// create a task and give it some dummy data for this example
$newtask = new Task();
$newtask->setsubject('add subject here');
$newtask->setdescription("write your feed back here");
$form = $this->createFormBuilder($newtask)
->add('subject', 'text')
->add('description', 'textarea')
->getForm();
return $this->render('ServiceRequestBundle:Desk:shownotification.html.twig', array('form' => $form->createView(),
));
}
在表格上點擊提交我打電話的功能中,我發送一封電子郵件
public function sendemailAction()
{
$messages = \Swift_Message::newInstance()
->setSubject('again Notification Email')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody("we know that you dont know whats happening")
;
$this->get('mailer')->send($messages);
return $this->render('ServiceRequestBundle:Desk:shownotification.html.twig');
}
現在問題是這是它工作正常。但發送4到5封電子郵件後,它停止工作,我的電子郵件不再發送。我的第一個猜測是因爲我一次又一次地調試我的應用程序,可能是因爲一次又一次發送同一封電子郵件而發生。我遵循這tutorial如果多數民衆贊成如此那麼我怎麼能解決這個問題,如果有任何其他問題,請幫助我。
我檢查我的PHP錯誤日誌,我發現這個
#0 [internal function]: Symfony\Component\HttpKernel\Debug\ErrorHandler->handle(2, 'SessionHandler:...', 'C:\xampp\htdocs...', 558, Array)
#1 C:\xampp\htdocs\jts\app\cache\dev\classes.php(558): SessionHandler->write('tatrpm617uplo16...', '_sf2_attributes...')
#2 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy->write('tatrpm617uplo16...', '_sf2_attributes...')
#3 [internal function]: session_write_close()
#4 {main}
thrown in C:\xampp\htdocs\jts\app\cache\dev\classes.php on line
存在之前'Swift_Message'你'sendemailAction()'線1額外的反斜線。錯字? – Raptor 2013-02-25 06:34:11
我試過,但仍然不工作我遵循這[教程](http://symfony.com/doc/current/cookbook/email/email.html) – numerah 2013-02-25 06:42:11
先嚐試簡單的PHP代碼。嘗試'mail()'函數來查看SMTP服務器是否正常工作。 – Raptor 2013-02-25 06:49:00