getAttachments returns null
Waiker opened this issue · 2 comments
Waiker commented
Hello, thanks for the project!
I want to use a command and when I receive a new email, save the attachment to a file.
My command code:
. . .
public function onNewMessage(Message $message){
if ($message->getAttachments()->count() == 1) {
$message->getAttachments()->first()->save(storage_path('frames/save'));
}
$this->info("New message received: ".$message->subject);
$this->info( "New message received: ". $message->getAttachments() );
}
. . .
But when sending email in console I get this:
_php artisan NameMyCommand
p/s I use Laravel Framework 8.83.23
Waiker commented
I don’t know what helped exactly, I rewrote the code many times and now it works.