Ah, syntax error on Line 12
Feb 5, 2022
5
Level 1
Laravel can't read temporary URL from AWS S3 bucket
Hi,
I have a Mail class like this:
class ReportMail extends Mailable { use Queueable, SerializesModels;
public $details;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($details)
{
$this->details = $details;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$content = Storage::disk('s3')->temporaryUrl(
'filename', now()->addMinutes(5)
);
return $this->subject('Test')->view('view')->attachFromStorageDisk('s3',$content);
}
}
In the controller class it will be called: Mail::to($email)->send(new ReportMail($details));
However, Laravel can't read the file:Illuminate\Contracts\Filesystem\FileNotFoundException File not found at path:.....(the temp URL has denied accessed).
AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY have been added. I wonder if the problem is from Laravel or AWS S3 bucket that the temp url can't be accessed.
Thanks for help.
Please or to participate in this conversation.