Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-send failed emails #1116

Open
CarlosNZ opened this issue Jul 3, 2024 · 3 comments
Open

Re-send failed emails #1116

CarlosNZ opened this issue Jul 3, 2024 · 3 comments
Labels
Feature: improvement Improvement to existing feature importance: Should have Issue that should be included, not needed in MVP

Comments

@CarlosNZ
Copy link
Collaborator

CarlosNZ commented Jul 3, 2024

Currently, if emails fail to send, they never get re-sent. The notification table keeps track of if the email send successfully, so we've got the information we need.

Just need to add a periodic scheduled task to check and re-attempt any failed ones, perhaps once a day I guess, and on server re-start.

@CarlosNZ CarlosNZ added Feature: improvement Improvement to existing feature importance: Should have Issue that should be included, not needed in MVP labels Jul 3, 2024
@CarlosNZ
Copy link
Collaborator Author

CarlosNZ commented Jul 3, 2024

Estimate: 4 hours

@CarlosNZ
Copy link
Collaborator Author

CarlosNZ commented Jul 4, 2024

There's a few other considerations for this:

  • How long do we keep trying? Cos eventually the email might become irrelevant -- e.g. if the user has already gone to the site on their own and made changes and re-submitted, then getting the email for the original request for changes would be confusing.
    • Is there any other ways to determine when to give up?
  • We should probably send an email to Support or Admin letting them known that an email has failed.
  • Need a way to suppress notifications if they've failed for reasons that will never change (e.g. invalid recipients). (Probably need another field in addition to "email_sent".)
  • Probably want to add a "email_attempt_timestamp" field which will be useful in determine time limits etc.

@CarlosNZ
Copy link
Collaborator Author

CarlosNZ commented Jul 4, 2024

Schema changes

On notification table:

  • New column: "email_status", with possible enum values:
    • NULL -- initial state, will remain like this if no email is attempted (i.e configured not to, or no valid addresses)
    • "SENT" -- sent successfully
    • "PENDING" -- when first attempting to send email
    • "ERROR" -- after initial failure
    • "GIVEN_UP" -- after exceeding maxAttempts or maxAge -- won't try any more
  • Remove "email_sent" field and migrate to new field: true -> "SENT", false -> "GIVEN_UP"
  • New column "email_send_attempt_timestamps" which is an array of timestamps which we keep adding to (default: [])

New "scheduler"

  • add to 'action' | 'cleanup' | 'backup' | 'archive' => "email"

New Server prefs:

  • emailSchedule
  • emailMaxAttempts (number)
  • emailMaxAge (days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: improvement Improvement to existing feature importance: Should have Issue that should be included, not needed in MVP
Projects
None yet
Development

No branches or pull requests

1 participant