I try to upload un file and attach it to the email I send But it does not work.
In my MailFile.php (created with php artisan make:mail)
public function __construct(Request $request)
{
$this->namePdf = $request->input('name-pdf');
$this->subjectPdf = $request->input('subject-pdf');
$this->emailPdf = $request->input('email-pdf');
$this->filePdf = $request->input('file-pdf');
}
public function build()
{
return $this->view('mails.sendFile')
->subject($this->subjectPdf)
->from('test@test.be', 'John Doe')
->attach($this->filePdf->getRealPath(), [
'as' => 'file.' . $this->filePdf->getClientOriginalExtension(),
'mime' => $this->filePdf->getMimeType()
]);
}
But it does not work. And I feel like I'm not using the right metod. Can you help me ?
via Jeremy