我正在使用symfony 2.8。我正在创建发送电子邮件的新服务。这是我的服务类,
<?php
namespace AppBundle\Service;
class MailManager
{
public function sendEmail($template, $sender, $recepient, $recepientEmail, $recepientSubject, $recepientMessage, $recepientCreated)
{
try{
$message = (new \Swift_Message('Contact Us Notitfication'))
->setFrom($sender)
->setTo($recepientEmail)
->setBody(
$this->renderView(
// app/Resources/views/Emails/registration.html.twig
$template,
array('name' => $recepient, 'email' => $recepientEmail, 'subject' => $recepientSubject, 'message' => $recepientMessage, 'created_at'=> $recepientCreated )
),
'text/html'
);
$response = $this->get('mailer')->send($message);
} catch(Exception $e){
$request->getSession()
->getFlashBag()
->add('error', $e->getMessage());
return $this->redirectToRoute('contact');
}
return $response;
}
}
在我的services.yml文件中,我包含了这个,
app.mail_manager:
class: AppBundle\Service\MailManager
arguments: []
现在我收到了这个错误
没有扩展功能可以加载&#34; app.mail_manager&#34; (在C:\ xampp \ htdocs \ mydoctor \ app / config \ servi ces.yml)。寻找命名空间&#34; app.mail_manager&#34;,找到&#34;框架&#34;,&#34;安全&#34;,&#34; twig&#34;,&#34; monolog&#34; ,&#34; swiftmailer&#34;,&#34; doct rine&#34;,&#34; sensio_framework_extra&#34;,&#34; app&#34;,&#34; mobile_detect&#34;,&#34; debug&#34;,&#34; web_profiler&#34;, &#34; sensio_distribution&#34;
如何解决此错误。请帮忙