領収証発行サービス
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 line
927B

  1. <?php
  2. namespace App\Jobs\Email;
  3. use App\Codes\QueueName;
  4. use App\Email\Sender;
  5. use App\Exceptions\TempFileNotExistsException;
  6. use App\Jobs\BaseJob;
  7. use App\Models\Email;
  8. use Illuminate\Support\Facades\Log;
  9. class SimpleEmail extends BaseJob
  10. {
  11. private string $emailId;
  12. /**
  13. * Create a new job instance.
  14. *
  15. * @return void
  16. */
  17. public function __construct(Email $email)
  18. {
  19. $this->emailId = $email->id;
  20. $this->onQueue(QueueName::EMAIL->value);
  21. }
  22. /**
  23. * Execute the job.
  24. *
  25. * @return void
  26. */
  27. public function handle()
  28. {
  29. try {
  30. Sender::send($this->emailId);
  31. } catch (TempFileNotExistsException $e) {
  32. // 一時ファイルが存在しないため、処理終了
  33. Log::warning(sprintf("ファイル存在しないため、メール送信処理スキップ :%s", $e->getFilepath()));
  34. }
  35. }
  36. }