how to send an email with django rest framework

Viewed 191

i have asked this question quite a lot of times in the python discord and other places but i still can't find out how to send an email to verify an account or reset a password in django rest framework.

i have watched these tutorials

https://www.youtube.com/watch?v=2kKwPk5qPUs

https://www.youtube.com/watch?v=BXg-b20Xusw&t=671s

https://saasitive.com/tutorial/django-rest-framework-reset-password/

https://djoser.readthedocs.io/en/latest/getting_started.html

i have also tried djoser but that hasnt worked and i have also tried the twilio sendgrid api with this tutorial https://www.mindbowser.com/integrating-sendgrid-with-django-rest-framework/

so does anyone have any answers on how to send an email with django rest framework?

1 Answers

If you use Djoser then set this settings in your settings.py file. It's work perfectly for account verification and reset password,etc. by email confirmation.

Docs : djoser setting docs.

DJOSER = {
        'PASSWORD_RESET_CONFIRM_URL': 'reset_password_confirm/{uid}/{token}',
        'USERNAME_RESET_CONFIRM_URL': 'username/reset/confirm/{uid}/{token}',
        'ACTIVATION_URL': 'user_activation/{uid}/{token}',
        'SEND_ACTIVATION_EMAIL': True,
        'SEND_CONFIRMATION_EMAIL':True,
        'PASSWORD_CHANGED_EMAIL_CONFIRMATION':True,
        'USERNAME_CHANGED_EMAIL_CONFIRMATION':True,
        'USER_CREATE_PASSWORD_RETYPE':True,
        'SET_PASSWORD_RETYPE':True,
        'PASSWORD_RESET_CONFIRM_RETYPE':True,
        'PASSWORD_RESET_SHOW_EMAIL_NOT_FOUND':True,
        'USERNAME_RESET_SHOW_EMAIL_NOT_FOUND':True,
        # 'LOGIN_FIELD':"email",
    }
Related