blob: e24d3e575612dc9dc5a8e44e279278228f01c41a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
from sbhs_server import settings
import smtplib
def email(to, subject, message):
smtpserver = smtplib.SMTP()
smtpserver.connect(settings.EMAIL_HOST, settings.EMAIL_PORT)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo()
#smtpserver.esmtp_features['auth']='LOGIN DIGEST-MD5 PLAIN'
smtpserver.login(settings.EMAIL_HOST_USER, settings.EMAIL_HOST_PASSWORD)
header = 'To: ' + to + '\n' + 'From: ' + settings.EMAIL_HOST_USER + '@iitb.ac.in\n' + 'Subject: ' + subject +' \n'
msg = header + '\n' + message + '\n\n'
#smtpserver.sendmail(settings.EMAIL_HOST_USER + '@iitb.ac.in', to, msg)
smtpserver.sendmail(settings.EMAIL_HOST_USER , to, msg)
smtpserver.close()
|