Php Laravel邮件附加二进制数据

Php Laravel邮件附加二进制数据,php,laravel-4,Php,Laravel 4,有没有办法将二进制数据附加为文件 \Mail::send('test', [], function ($message) { $message->to('xxxxxx.@xx.com', 'X X')->subject('TEST'); $message->attach($file_binary_data); }); 我已经检查过了,但是电子邮件没有发送。只提供了一个没有错误的空白页。1,基于邮件API的驱动程序(如Mailgun和Mandrill)通

有没有办法将二进制数据附加为文件

\Mail::send('test', [], function ($message) {
      $message->to('xxxxxx.@xx.com', 'X X')->subject('TEST');
      $message->attach($file_binary_data);
});

我已经检查过了,但是电子邮件没有发送。只提供了一个没有错误的空白页。

1,基于邮件API的驱动程序(如Mailgun和Mandrill)通常比SMTP服务器更简单、更快。您应该首先注册一个mailgun或mandrill帐户,或者使用您的邮件smtp(您可以在电子邮件设置中获得smtp信息)

2,“测试”视图文件必须存在于“资源/视图”目录中


3、$file\u binary\u数据必须存在于本地文件系统中。

1,基于邮件API的驱动程序(如Mailgun和Mandrill)通常比SMTP服务器更简单、更快。您应该首先注册一个mailgun或mandrill帐户,或者使用您的邮件smtp(您可以在电子邮件设置中获得smtp信息)

2,“测试”视图文件必须存在于“资源/视图”目录中

3、$file\u binary\u数据必须存在于本地文件系统中。

使用attachData方法:

\Mail::send('test', [], function ($message) {
      $message->to('xxxxxx.@xx.com', 'X X')->subject('TEST');
      //$message->attach($file_binary_data);
      $message->attachData($file_binary_data, 'my-file-name.pdf', []);
});
使用attachData方法:

\Mail::send('test', [], function ($message) {
      $message->to('xxxxxx.@xx.com', 'X X')->subject('TEST');
      //$message->attach($file_binary_data);
      $message->attachData($file_binary_data, 'my-file-name.pdf', []);
});