在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public function send($filename, array $render = [],$subject = '审核通知') { // Create the Transport $transport = (new Swift_SmtpTransport('host', 'port')) ->setUsername() ->setPassword() ; $mailer = new Swift_Mailer($transport); $message = (new Swift_Message($subject)) ->setFrom([]) ->setTo([]) ->setBody() ->addPart($this->blade($filename, $render), 'text/html') ->attach(Swift_Attachment::fromPath('http://cdn.sweetsunnyflower.com/blog/images/featured-posts/1-1.jpg'))//这里是添加附件 ; // Send the message return $result = $mailer->send($message); } /** * @return string */ public function blade($filename, array $render) { $templates = League\Plates\Engine::create(__DIR__ . '/views'); return $templates->render($filename, $render); }
|
请发表评论