TestSendMail.php 1021 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use Mail;
  5. use App\Mail\InviteMail;
  6. use Illuminate\Support\Str;
  7. class TestSendMail extends Command
  8. {
  9. /**
  10. * The name and signature of the console command.
  11. *
  12. * @var string
  13. */
  14. protected $signature = 'test:send.mail';
  15. /**
  16. * The console command description.
  17. *
  18. * @var string
  19. */
  20. protected $description = 'Command description';
  21. /**
  22. * Create a new command instance.
  23. *
  24. * @return void
  25. */
  26. public function __construct()
  27. {
  28. parent::__construct();
  29. }
  30. /**
  31. * Execute the console command.
  32. *
  33. * @return int
  34. */
  35. public function handle()
  36. {
  37. if(\App\Tools\Tools::isStop()){
  38. return 0;
  39. }
  40. $uuid = Str::uuid();
  41. Mail::to("visuddhinanda@gmail.com")
  42. ->send(new InviteMail($uuid));
  43. if(Mail::failures()){
  44. $this->error('send email fail');
  45. }
  46. return 0;
  47. }
  48. }