From da6cc151d1bcd3670013c6ee4b318effaf57250f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 11 Sep 2023 12:31:31 +0200 Subject: [PATCH] fix: email sending error --- app/Jobs/SendConfirmationForWaitlistJob.php | 4 +--- routes/webhooks.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Jobs/SendConfirmationForWaitlistJob.php b/app/Jobs/SendConfirmationForWaitlistJob.php index 041b418ec..a8790f27f 100755 --- a/app/Jobs/SendConfirmationForWaitlistJob.php +++ b/app/Jobs/SendConfirmationForWaitlistJob.php @@ -25,10 +25,8 @@ public function handle() { try { $mail = new MailMessage(); - $confirmation_url = base_url() . '/webhooks/waitlist/confirm?email=' . $this->email . '&confirmation_code=' . $this->uuid; $cancel_url = base_url() . '/webhooks/waitlist/cancel?email=' . $this->email . '&confirmation_code=' . $this->uuid; - $mail->view('emails.waitlist-confirmation', [ 'confirmation_url' => $confirmation_url, @@ -37,7 +35,7 @@ public function handle() $mail->subject('You are on the waitlist!'); send_user_an_email($mail, $this->email); } catch (\Throwable $th) { - send_internal_notification("SendConfirmationForWaitlistJob failed for {$mail} with error: " . $th->getMessage()); + send_internal_notification("SendConfirmationForWaitlistJob failed for {$this->email} with error: " . $th->getMessage()); ray($th->getMessage()); throw $th; } diff --git a/routes/webhooks.php b/routes/webhooks.php index 9a5f72ce1..f05df9c5a 100644 --- a/routes/webhooks.php +++ b/routes/webhooks.php @@ -189,12 +189,16 @@ send_internal_notification('Waitlist confirmed: ' . $email); return 'Thank you for confirming your email address. We will notify you when you are next in line.'; } else { + $found->delete(); + send_internal_notification('Waitlist expired: ' . $email); return 'Your confirmation code has expired. Please sign up again.'; } } } return redirect()->route('dashboard'); - } catch (error) { + } catch (Exception $e) { + send_internal_notification('Waitlist confirmation failed: ' . $e->getMessage()); + ray($e->getMessage()); return redirect()->route('dashboard'); } })->name('webhooks.waitlist.confirm'); @@ -209,7 +213,9 @@ return 'Your email address has been removed from the waitlist.'; } return redirect()->route('dashboard'); - } catch (error) { + } catch (Exception $e) { + send_internal_notification('Waitlist cancellation failed: ' . $e->getMessage()); + ray($e->getMessage()); return redirect()->route('dashboard'); } })->name('webhooks.waitlist.cancel');