Subversion Repositories SmartDukaan

Rev

Rev 14100 | Rev 14102 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14100 Rev 14101
Line 221... Line 221...
221
    filename = "/tmp/deal-data-user-specific"+str(datetime.now())+".xls" 
221
    filename = "/tmp/deal-data-user-specific"+str(datetime.now())+".xls" 
222
    wbk.save(filename)
222
    wbk.save(filename)
223
    smtpServer = smtplib.SMTP('localhost')
223
    smtpServer = smtplib.SMTP('localhost')
224
    #smtpServer.set_debuglevel(1)
224
    #smtpServer.set_debuglevel(1)
225
    sender = 'dtr@shop2020.in'
225
    sender = 'dtr@shop2020.in'
-
 
226
    if userId==27:
226
    #recipients = ['kshitij.sood@saholic.com']
227
        recipients = ['kshitij.sood@saholic.com']
-
 
228
    else:
-
 
229
        recipients = ['rajneesh.arora@saholic.com','kshitij.sood@saholic.com']
227
    msg = MIMEMultipart()
230
    msg = MIMEMultipart()
228
    msg['Subject'] = "DTR Deals data (UserOnly) UserId - "+str(userId)+"" + ' - ' + str(datetime.now())
231
    msg['Subject'] = "DTR Deals data (UserOnly) UserId - "+str(userId)+"" + ' - ' + str(datetime.now())
229
    msg['From'] = sender
232
    msg['From'] = sender
230
    recipients = ['rajneesh.arora@saholic.com','kshitij.sood@saholic.com']
-
 
231
    msg['To'] = ",".join(recipients)
233
    msg['To'] = ",".join(recipients)
232
    fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
234
    fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
233
    fileMsg.set_payload(file(filename).read())
235
    fileMsg.set_payload(file(filename).read())
234
    email.encoders.encode_base64(fileMsg)
236
    email.encoders.encode_base64(fileMsg)
235
    fileMsg.add_header('Content-Disposition','attachment;filename=User_Deal_Sheet_Dtr.xls')
237
    fileMsg.add_header('Content-Disposition','attachment;filename=User_Deal_Sheet_Dtr.xls')