消息包含Symfony2,SwiftMailer中的HTTP响应

时间:2014-07-23 11:21:30

标签: php symfony swiftmailer

当包含HTTP响应的电子邮件服务器上出现消息时:

  

HTTP / 1.0 200 OK缓存控制:无缓存日期:2014年7月23日星期三   格林威治标准时间07:36:31 ...这里的俄文文本......

我有以下服务发送邮件。

<?php

namespace noxaeterna\MainBundle\Service;

class MailService
{
    protected $mailer;

    public function __construct(\Swift_Mailer $mailer)
    {
        $this->mailer = $mailer;
    }

    public function sendMail($from, $to, $body, $subject = '')
    {
        $message = \Swift_Message::newInstance()
            ->setCharset('UTF-8')
            ->setContentType("text/html")
            ->setSubject($subject)
            ->setFrom($from)
            ->setTo($to)
            ->setBody($body);

        $this->mailer->send($message);
    }
}

我希望你能提供帮助。

0 个答案:

没有答案