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

Fallback email sender #134

Closed
rodrigoegimenez opened this issue Nov 16, 2020 · 1 comment
Closed

Fallback email sender #134

rodrigoegimenez opened this issue Nov 16, 2020 · 1 comment

Comments

@rodrigoegimenez
Copy link

Hi!

We've recently started using this package and implemented on top of it the possibility to specify an alternative email server as backup in case the main sending mechanism fails.

After reading this PR I wanted to check with you first if it might be of use for the package to have this addition. The commit is this one, the idea is basically set up two additional settings variables: MAILER_FALLBACK_EMAIL_BACKEND and EMAIL_FALLBACK_CONFIG which, if present, are used in case the main sending mechanism fails.

If it makes an useful addition let me know and I'll send a pull request.

@spookylukey
Copy link
Contributor

As before, I think this is best handled by a backend that implements the "fallback strategy". So you have:

  • django_mailer, which provides a mail backend that saves things to the DB for later sending
    • and requires a single other backend to actually do the sending
  • a "fallback strategy" backend that is either hardcoded to use 2 different backends, or could be configured to use a list of other backends.
  • you then point MAILER_EMAIL_BACKEND at your "fallback strategy" backend

Structured this way, you can compose the behaviours you want very nicely, without having to tie any of these together. So, for example, your "fallback strategy" backend could be used without django-mailer at all.

If there is some reason this won't work, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants