how to send email using djnago

Viewed 18

I have a situation where using API android app will POST the user Data to my django website and a entry is created in my backend .I want to send email to the user after the entry has been created in django. I have created a indicator which will get true when Data is POST. ANy suggestion how to use that indicator for sending email to every new entry created .

1 Answers

Django does the work for you :

  from django.core.mail import send_mail

send_mail(
    'Subject here',
    'Here is the message.',
    'from@example.com',
    ['to@example.com'],
    fail_silently=False,
)

But you need to setup your email service such as Gmail or Sendgrid

Related