dpa0760 2019-01-28 20:30
浏览 73

没有找到Swift Mailer Swift_Attachment类

I am attaching PDF into email, PDF is generated through mPDF and it's generated perfectly. But when I try to attach it into email using Swift Mailer it's always giving me class error that Swift_Attachment class not found

Code

require __DIR__.'/swiftmailer/lib/classes/Swift.php';

$attachment = new Swift_Attachment($html, 'phpflow.pdf', 'application/pdf');

$message = Swift_Message::newInstance()
  ->setSubject('Here is the subject')
  ->setFrom(array('john@doe.com' => 'John Doe'))
  ->setTo(array('acb@gmail.com'))
  ->setBody('Here is the message itself')
  ->attach($attachment);

$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);
$mpdf->Output($filename ,'I');

I don't know what's wrong here, suggest me

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!