I am trying to attach some documents to an email, using Laravel's attachFromStorageDisk
method, that I read about in the documentation: Mail - Laravel.
public function build()
{
$email = $this->view('emails.message')
->subject($this->emailSubject);
foreach ($this->attachments as $attachment) {
$email->attachFromStorageDisk('filemanager', $attachment);
}
return $email;
}
And the error I'm getting is this Illegal string offset 'file' on line 342, file Illuminate/Mail/Mailable.php
and I can't figure out a way to fix this.
$this->attachments
is an array containing the paths to the files I want to attach to the e-mail, and all the paths are correct.
Do you guys have any idea how to solve this? I couldn't find much about this specific error on line 342, Mailable.php
Thanks!
Change the name of your variable $this->attachments
to something else
Mailable class already has property $attachments
, which you are overwriting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With