0

I built a website in Django, I have a form that stores the information of my clients in my database, but I want that when a person sends their info I receive an email with their information instead of checking my database data.

  • 3
    Have a go before asking someone else to do it for you: https://docs.djangoproject.com/en/2.2/topics/email/ – HenryM Aug 28 '19 at 18:06

2 Answers2

0

In case that you want to use Gmail account, check this: How to send an email with Gmail as provider using Python?

The general doc. info is on https://docs.djangoproject.com/en/2.2/topics/email/

0
import smtplib
from email.mime.text import MIMEText

s = smtplib.SMTP(' ')#smtp server like Gmail, outlook 
s.set_debuglevel(1)
msg = MIMEText("""body""")
sender = ' '#your email ID in string
recipients = [' ', ] #recipient's email must be in list
msg['Subject'] = "subject line"
msg['From'] = sender
msg['To'] = recipients
s.sendmail(sender, recipients, msg.as_string())
Vishak Raj
  • 83
  • 2
  • 10