| Line 18... |
Line 18... |
| 18 |
DB_USER = "root"
|
18 |
DB_USER = "root"
|
| 19 |
DB_PASSWORD = "shop2020"
|
19 |
DB_PASSWORD = "shop2020"
|
| 20 |
DB_NAME = "dtr"
|
20 |
DB_NAME = "dtr"
|
| 21 |
TMP_FILE = "User_Invite_Report.xls"
|
21 |
TMP_FILE = "User_Invite_Report.xls"
|
| 22 |
|
22 |
|
| 23 |
LIST_EMAILS = ['manas.kapoor@shop2020.in','shailesh.kumar@shop2020.in,amit.sirohi@shop2020.in,ritesh.chauhan@shop2020.in']
|
23 |
LIST_EMAILS = ['rajender.singh@shop2020.in','shailesh.kumar@shop2020.in,amit.sirohi@shop2020.in,ritesh.chauhan@shop2020.in']
|
| 24 |
# KEY NAMES
|
24 |
# KEY NAMES
|
| 25 |
SENDER = "cnc.center@shop2020.in"
|
25 |
SENDER = "cnc.center@shop2020.in"
|
| 26 |
PASSWORD = "5h0p2o2o"
|
26 |
PASSWORD = "5h0p2o2o"
|
| 27 |
SUBJECT = "User Invite Activation Report for " + date.today().isoformat()
|
27 |
SUBJECT = "User Invite Activation Report for " + date.today().isoformat()
|
| 28 |
SMTP_SERVER = "smtp.gmail.com"
|
28 |
SMTP_SERVER = "smtp.gmail.com"
|
| Line 70... |
Line 70... |
| 70 |
column = 0
|
70 |
column = 0
|
| 71 |
for data in r :
|
71 |
for data in r :
|
| 72 |
worksheet.write(row, column, int(data) if type(data) is float else data, datetime_format if type(data) is datetime.datetime else default_format)
|
72 |
worksheet.write(row, column, int(data) if type(data) is float else data, datetime_format if type(data) is datetime.datetime else default_format)
|
| 73 |
column += 1
|
73 |
column += 1
|
| 74 |
workbook.save(TMP_FILE)
|
74 |
workbook.save(TMP_FILE)
|
| 75 |
sendmail(['manas.kapoor@shop2020.in','rajneesh.arora@saholic.com','shailesh.kumar@shop2020.in,amit.sirohi@shop2020.in,ritesh.chauhan@shop2020.in'], "", TMP_FILE, SUBJECT)
|
75 |
sendmail(['rajender.singh@shop2020.in','rajneesh.arora@saholic.com','shailesh.kumar@shop2020.in,amit.sirohi@shop2020.in,ritesh.chauhan@shop2020.in'], "", TMP_FILE, SUBJECT)
|
| 76 |
|
76 |
|
| 77 |
|
77 |
|
| 78 |
|
78 |
|
| 79 |
def sendmail(email, message, fileName, title):
|
79 |
def sendmail(email, message, fileName, title):
|
| 80 |
if email == "":
|
80 |
if email == "":
|
| Line 94... |
Line 94... |
| 94 |
fileMsg = MIMEBase('application', 'vnd.ms-excel')
|
94 |
fileMsg = MIMEBase('application', 'vnd.ms-excel')
|
| 95 |
fileMsg.set_payload(file(TMP_FILE).read())
|
95 |
fileMsg.set_payload(file(TMP_FILE).read())
|
| 96 |
encoders.encode_base64(fileMsg)
|
96 |
encoders.encode_base64(fileMsg)
|
| 97 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
97 |
fileMsg.add_header('Content-Disposition', 'attachment;filename=' + fileName)
|
| 98 |
msg.attach(fileMsg)
|
98 |
msg.attach(fileMsg)
|
| 99 |
MAILTO=['manas.kapoor@shop2020.in','rajneesh.arora@saholic.com','shailesh.kumar@shop2020.in,amit.sirohi@shop2020.in,ritesh.chauhan@shop2020.in']
|
99 |
MAILTO=['rajender.singh@shop2020.in','rajneesh.arora@saholic.com','shailesh.kumar@shop2020.in,amit.sirohi@shop2020.in,ritesh.chauhan@shop2020.in']
|
| 100 |
mailServer.login(SENDER, PASSWORD)
|
100 |
mailServer.login(SENDER, PASSWORD)
|
| 101 |
mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
|
101 |
mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
|
| 102 |
|
102 |
|
| 103 |
def main():
|
103 |
def main():
|
| 104 |
generateInviteReport()
|
104 |
generateInviteReport()
|