我在Django中建立了一个网站,我有一个将客户信息存储在数据库中的表格,但是我希望当某人发送其信息时,我会收到一封包含其信息的电子邮件,而不是检查我的数据库数据。 / p>
答案 0 :(得分:0)
如果要使用Gmail帐户,请检查以下内容: How to send an email with Gmail as provider using Python?
上答案 1 :(得分: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())