使用laravel Mail Facade附加大文件

时间:2017-07-03 12:20:45

标签: php laravel email

当我尝试附加大于1MB的大文件时,会出现此错误

消息:fwrite():5067字节的发送失败,errno = 11资源暂时不可用

file:" /var/www/html/test/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php"

这是我的代码

module.php

中的

Mail::to($data[EMAIL])->send(new SigningApplication($data));

SigningApplication.php

中的

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class SigningApplication extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */


    public $user_data;

    public function __construct($user_data)
    {
        $this->user_data = $user_data;

    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {

        return $this->from(config('email'), config('mail.from')['name'])
            ->view('emails.signing_application')
            ->attach($this->user_data['pdf'],['mime' => 'application/pdf'])


    }
}

0 个答案:

没有答案