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

How to use EmailDevice subclass with email plugin? #747

Open
ebeers-png opened this issue Dec 19, 2024 · 1 comment
Open

How to use EmailDevice subclass with email plugin? #747

ebeers-png opened this issue Dec 19, 2024 · 1 comment
Labels

Comments

@ebeers-png
Copy link

I'm using django-otp and django-two-factor-auth for MFA through email. I want to customize the send_mail method in django-otp's EmailDevice model to use my own custom email code, and keep everything else the same. But I've tried subclassing EmailDevice both with a regular model and a proxy model, and in both cases django-two-factor-auth's email plugin doesn't use my send_mail method.

Is there a way to override send_mail and get it to work with django-two-factor-auth's email plugin? The only alternative I can think of is to fork either django-otp or django-two-factor-auth and change the code to what I need, but is there a simpler way I haven't thought of?

@moggers87
Copy link
Collaborator

The email plugin uses send_mail from django.core.mail. Have you tried writing your own email backend for Django? Relevant docs:

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

No branches or pull requests

2 participants