Subversion Repositories SmartDukaan

Rev

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

Rev 10432 Rev 10434
Line 253... Line 253...
253
    mailServer = smtplib.SMTP("smtp.gmail.com", 587)
253
    mailServer = smtplib.SMTP("smtp.gmail.com", 587)
254
    mailServer.ehlo()
254
    mailServer.ehlo()
255
    mailServer.starttls()
255
    mailServer.starttls()
256
    mailServer.ehlo()
256
    mailServer.ehlo()
257
    
257
    
258
    recipients = ['kshitij.sood@saholic.com']
258
    #recipients = ['kshitij.sood@saholic.com']
259
    #recipients = ['rajneesh.arora@saholic.com','rajveer.singh@saholic.com','vikram.raghav@saholic.com','kshitij.sood@saholic.com','khushal.bhatia@saholic.com','chaitnaya.vats@saholic.com','chandan.kumar@saholic.com','manoj.kumar@saholic.com','yukti.jain@saholic.com','ankush.dhingra@saholic.com','manoj.pal@saholic.com']
259
    recipients = ['rajneesh.arora@saholic.com','rajveer.singh@saholic.com','kshitij.sood@saholic.com','khushal.bhatia@saholic.com','chaitnaya.vats@saholic.com','chandan.kumar@saholic.com','manoj.kumar@saholic.com','yukti.jain@saholic.com','ankush.dhingra@saholic.com','manoj.pal@saholic.com','sandeep.sachdeva@saholic.com']
260
    msg = MIMEMultipart()
260
    msg = MIMEMultipart()
261
    msg['Subject'] = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
261
    msg['Subject'] = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
262
    msg['From'] = ""
262
    msg['From'] = ""
263
    msg['To'] = ",".join(recipients)
263
    msg['To'] = ",".join(recipients)
264
    msg.preamble = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
264
    msg.preamble = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
Line 426... Line 426...
426
    
426
    
427
    filename = "/tmp/snapdeal-tp-reconciliation-" + str(datetime.now()) + ".xls"
427
    filename = "/tmp/snapdeal-tp-reconciliation-" + str(datetime.now()) + ".xls"
428
    wbk.save(filename)
428
    wbk.save(filename)
429
    
429
    
430
    try:
430
    try:
431
        EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["kshitij.sood@saholic.com"], " Snapdeal TP Reconciliation "+ str(datetime.now()), "", [get_attachment_part(filename)], [""], [])
431
        #EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["kshitij.sood@saholic.com"], " Snapdeal TP Reconciliation "+ str(datetime.now()), "", [get_attachment_part(filename)], [""], [])
432
        #EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["chandan.kumar@saholic.com","manoj.kumar@saholic.com","yukti.jain@saholic.com","ankush.dhingra@saholic.com","manoj.pal@saholic.com"], " Snapdeal TP Reconciliation "+ str(datetime.now()), "", [get_attachment_part(filename)], ["rajneesh.arora@saholic.com","rajveer.singh@saholic.com","vikram.raghav@saholic.com","kshitij.sood@saholic.com","chaitnaya.vats@saholic.com","khushal.bhatia@saholic.com"], [])
432
        EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["chandan.kumar@saholic.com","manoj.kumar@saholic.com","yukti.jain@saholic.com","ankush.dhingra@saholic.com","manoj.pal@saholic.com","sandeep.sachdeva@saholic.com"], " Snapdeal TP Reconciliation "+ str(datetime.now()), "", [get_attachment_part(filename)], ["rajneesh.arora@saholic.com","kshitij.sood@saholic.com","chaitnaya.vats@saholic.com","khushal.bhatia@saholic.com"], [])
433
    except Exception as e:
433
    except Exception as e:
434
        print e
434
        print e
435
        print "Unable to send report.Trying with local SMTP"
435
        print "Unable to send report.Trying with local SMTP"
436
        smtpServer = smtplib.SMTP('localhost')
436
        smtpServer = smtplib.SMTP('localhost')
437
        smtpServer.set_debuglevel(1)
437
        smtpServer.set_debuglevel(1)
438
        sender = 'support@shop2020.in'
438
        sender = 'support@shop2020.in'
439
        recipients = ['kshitij.sood@saholic.com']
439
        #recipients = ['kshitij.sood@saholic.com']
440
        msg = MIMEMultipart()
440
        msg = MIMEMultipart()
441
        msg['Subject'] = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
441
        msg['Subject'] = "Snapdeal TP Reconciliation" + ' - ' + str(datetime.now())
442
        msg['From'] = sender
442
        msg['From'] = sender
443
        #recipients = ['rajneesh.arora@saholic.com','rajveer.singh@saholic.com','vikram.raghav@saholic.com','kshitij.sood@saholic.com','khushal.bhatia@saholic.com','chaitnaya.vats@saholic.com','chandan.kumar@saholic.com','manoj.kumar@saholic.com','yukti.jain@saholic.com','ankush.dhingra@saholic.com','manoj.pal@saholic.com']
443
        recipients = ['rajneesh.arora@saholic.com','kshitij.sood@saholic.com','khushal.bhatia@saholic.com','chaitnaya.vats@saholic.com','chandan.kumar@saholic.com','manoj.kumar@saholic.com','yukti.jain@saholic.com','ankush.dhingra@saholic.com','manoj.pal@saholic.com','sandeep.sachdeva@saholic.com']
444
        msg['To'] = ",".join(recipients)
444
        msg['To'] = ",".join(recipients)
445
        fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
445
        fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
446
        fileMsg.set_payload(file(filename).read())
446
        fileMsg.set_payload(file(filename).read())
447
        email.encoders.encode_base64(fileMsg)
447
        email.encoders.encode_base64(fileMsg)
448
        fileMsg.add_header('Content-Disposition','attachment;filename=snapdeal_tp_recon.xls')
448
        fileMsg.add_header('Content-Disposition','attachment;filename=snapdeal_tp_recon.xls')