Home > Software engineering >  When to use API vs SMTP in Django
When to use API vs SMTP in Django

Time:12-12

Can API be used to replace SMTP for mail sending in Django especially for things like reset password and mail confirmation.

I will really love if I can get clarification on a topic in django. I am a newbie to django and when it comes to sending mail I register for Mailgun and used the API since I have used requests before but picking up django to work with I am trying to do user registration using DJ-Rest-auth and django_allauth and there is thing about configuring email backend using SMTP.

my question is

  • Can i do without using SMTP for django_allauth if Yes a workflow how to connect my password reset to use the api for mail.
  • I can easily pass in the mail function to serve as an alert in the views when user registers

I know I can send mails using django but things like reset password that has a uuid attached to it how can I go about it using API's

def send_simple_message(name, email, phone, course, mode):
    """ send mail after successful registration. """

    
    return requests.post(
        MAILGUN_BASE_URL,
        auth=("api", MAILGUN_KEY),
        data={"from": "mail <[email protected]>",
            "to": ["[email protected]"],
            "subject": "           
  • Related