領収証発行サービス
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

42 行
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. }