Mail with attachment - Laravel

0

I am trying to send an email with an attachment when a record is created. This attachment is in the public directory of the project (public / registers_img)

public function build()
{
    $this->subject('Correo de notificación');
    return $this->markdown('Mails.newRegister')
        ->with(['employeeName' => $this->name, 'Date'=>$this->date, 'Note'=>$this->note])
        ->attachFromStorage(public_path('registers_img'.$this->file));
}

When sending the email I get this error

{message: "C:\xampp\htdocs\GMacro\public\registers_img18-11-06_Global_Test.png",…}
exception: "Illuminate\Contracts\Filesystem\FileNotFoundException"
    
asked by gmrYaeL 29.11.2018 в 17:13
source

1 answer

0

Solved

Instead of

 ->attachFromStorage(public_path('registers_img\'.$this->file));

Use

->attach(public_path('registers_img\'.$this->file));
    
answered by 29.11.2018 / 17:30
source