|
- <?php
-
- namespace App\Jobs\Email;
-
- use App\Codes\QueueName;
- use App\Email\Sender;
- use App\Exceptions\TempFileNotExistsException;
- use App\Jobs\BaseJob;
- use App\Models\Email;
- use Illuminate\Support\Facades\Log;
-
- class SimpleEmail extends BaseJob
- {
- private string $emailId;
-
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct(Email $email)
- {
- $this->emailId = $email->id;
- $this->onQueue(QueueName::EMAIL->value);
- }
-
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- try {
- Sender::send($this->emailId);
- } catch (TempFileNotExistsException $e) {
- // 一時ファイルが存在しないため、処理終了
- Log::warning(sprintf("ファイル存在しないため、メール送信処理スキップ :%s", $e->getFilepath()));
- }
- }
- }
|