Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sweetie1391991's avatar

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.

0 likes
5 replies
sweetie1391991's avatar

@Snapey hi, I didn't copy the whole file, just the basic idea of it. So I couldn't locate line 12. Which one did you mean?

Please or to participate in this conversation.