added email configuration to config.ini
This commit is contained in:
parent
37076cab79
commit
9199368602
|
@ -183,7 +183,7 @@ def email(zipArchive):
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.base import MIMEBase
|
||||||
from email import encoders
|
from email import encoders
|
||||||
|
|
||||||
fromaddr = "navanchauhan@gmail.com"
|
fromaddr = config['SMTP']['EMAIL']
|
||||||
|
|
||||||
msg = MIMEMultipart()
|
msg = MIMEMultipart()
|
||||||
msg['From'] = fromaddr
|
msg['From'] = fromaddr
|
||||||
|
@ -200,9 +200,9 @@ def email(zipArchive):
|
||||||
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
||||||
msg.attach(p)
|
msg.attach(p)
|
||||||
|
|
||||||
s = smtplib.SMTP('smtp.gmail.com', 587)
|
s = smtplib.SMTP(config['SMTP']['SERVER'], config['SMTP']['PORT'])
|
||||||
s.starttls()
|
s.starttls()
|
||||||
s.login(fromaddr, 'okrs shoc ahtk idui')
|
s.login(fromaddr, config['SMTP']['PASSWORD'])
|
||||||
text = msg.as_string()
|
text = msg.as_string()
|
||||||
|
|
||||||
s.sendmail(fromaddr, toaddr, text)
|
s.sendmail(fromaddr, toaddr, text)
|
||||||
|
|
|
@ -28,7 +28,7 @@ def email(zipArchive):
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.base import MIMEBase
|
||||||
from email import encoders
|
from email import encoders
|
||||||
|
|
||||||
fromaddr = "navanchauhan@gmail.com"
|
fromaddr = config['SMTP']['EMAIL']
|
||||||
toaddr = toEmail
|
toaddr = toEmail
|
||||||
|
|
||||||
msg = MIMEMultipart()
|
msg = MIMEMultipart()
|
||||||
|
@ -46,9 +46,9 @@ def email(zipArchive):
|
||||||
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
||||||
msg.attach(p)
|
msg.attach(p)
|
||||||
|
|
||||||
s = smtplib.SMTP('smtp.gmail.com', 587)
|
s = smtplib.SMTP(config['SMTP']['SERVER'], config['SMTP']['PORT'])
|
||||||
s.starttls()
|
s.starttls()
|
||||||
s.login(fromaddr, 'okrs shoc ahtk idui')
|
s.login(fromaddr, config['SMTP']['PASSWORD'])
|
||||||
text = msg.as_string()
|
text = msg.as_string()
|
||||||
|
|
||||||
s.sendmail(fromaddr, toaddr, text)
|
s.sendmail(fromaddr, toaddr, text)
|
||||||
|
|
|
@ -5,6 +5,12 @@ USER = curieweb
|
||||||
PASSWORD = curie-web-russian-54
|
PASSWORD = curie-web-russian-54
|
||||||
NAME = curie
|
NAME = curie
|
||||||
|
|
||||||
|
[SMTP]
|
||||||
|
SERVER = smtp.gmail.com
|
||||||
|
PORT = 587
|
||||||
|
EMAIL = navanchauhan@gmail.com
|
||||||
|
PASSWORD = okrs shoc ahtk idui
|
||||||
|
|
||||||
[LOGS]
|
[LOGS]
|
||||||
ERRORS = logs/errors.log
|
ERRORS = logs/errors.log
|
||||||
INFO = data/info.log
|
INFO = data/info.log
|
||||||
|
|
Loading…
Reference in New Issue