laravel-imap icon indicating copy to clipboard operation
laravel-imap copied to clipboard

getAttachments returns null

Open Waiker opened this issue 3 years ago • 2 comments

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

image

p/s I use Laravel Framework 8.83.23

Waiker avatar Sep 15 '22 20:09 Waiker

I don’t know what helped exactly, I rewrote the code many times and now it works.

Waiker avatar Sep 17 '22 22:09 Waiker

Hi @Waiker , great :) Perhaps something was still cached?

Best regards,

Webklex avatar Sep 19 '22 01:09 Webklex