【问题标题】:Laravel 4 attach PDF to emailLaravel 4 将 PDF 附加到电子邮件
【发布时间】:2014-09-09 00:36:17
【问题描述】:

我有问题。我创建了一个附加到电子邮件的 PDF,但电子邮件是空的。它没有任何附加文件。

这是我的代码:

$pdf = PDF::load($html, 'Letter', 'portrait')->output();
$ruta_pdf = public_path().'/tmp/'.$factura->folio_fiscal.".pdf";
File::put($ruta_pdf, $pdf);

Mail::send('emails.factura', $data, function($message) use ($emisor, $receptor, $factura, $ruta_xml, $ruta_pdf){

$message->attach($ruta_pdf);
$message->from('mail@apscreativas.com', $emisor->nombre);
$message->to('mail2@apscreativas.com', $receptor->nombre);
$message->subject('SUbject');

});

我找到了解决办法,邮件模板不能为空,必须有一个最小的模板。

【问题讨论】:

    标签: php pdf laravel-4 email-attachments


    【解决方案1】:

    $ruta_pdfMail::send 调用中不存在。您需要将其添加到 use() 部分的变量中,以便它出现在您的邮件回调中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-21
      • 2016-01-18
      • 1970-01-01
      • 2017-04-12
      • 1970-01-01
      • 2016-09-28
      相关资源
      最近更新 更多