title: Send an email after command has finished in Laravel
body: <p>I have a command written on laravel which I wanna execute. It will take up at least 4 hours so I'd like to get an e-mail from the computer when the task is over. I'm using queues so I'd like to append the whole operation but I don't know if it's possible. </p>
  
  <p>This is the current task:</p>
  
  <pre><code>public function handle()
      {
  
          $directory = 'pv';
          $files = Storage::allFiles($directory);
          foreach($files as $file)
          {
              $fname = basename($file);
              \Log::info('Procesando ',[$fname]);
              $arr = explode(" ", $fname);
              $day = substr($arr[2], 0, 10);
              $date = Carbon::parse($day);
              // this process goes to a queue in chunks
              Excel::queueImport(new POSImport($date), $file);
          }
      }
  </code></pre>
  
  <p>How do I append a new job that sends an e-mail after all is over? I'm not sure if I have to make a new command or a new job. I have the email job already tested and it works. </p>
  
  <p>App\Jobs\SendMailFinished.php </p>
  
  <pre><code>public function handle()
      {
          //Sends message
          $me = 'me@example.com';
          $msg = 'Process finished';
          Mail::to($me)-&gt;queue(new TasksFinished($msg));
      }
  </code></pre>