Subversion Repositories SmartDukaan

Rev

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

Rev 11981 Rev 11984
Line 510... Line 510...
510
    encoders.encode_base64(fileMsg)
510
    encoders.encode_base64(fileMsg)
511
    from datetime import date
511
    from datetime import date
512
    fileMsg.add_header('Content-Disposition','attachment;filename=Return-Source-Wise' + ' - ' + date.today().isoformat() + '.xls')
512
    fileMsg.add_header('Content-Disposition','attachment;filename=Return-Source-Wise' + ' - ' + date.today().isoformat() + '.xls')
513
    msg.attach(fileMsg)
513
    msg.attach(fileMsg)
514
    try:
514
    try:
515
        mailServer.login("build@shop2020.in", "cafe@nes")
515
        mailServer.login("cnc.center@shop2020.in", "5h0p2o2o")
516
        #mailServer.sendmail("cafe@nes", ['kshitij.sood@saholic.com'], msg.as_string())
516
        #mailServer.sendmail("cafe@nes", ['kshitij.sood@saholic.com'], msg.as_string())
517
        mailServer.sendmail("cafe@nes", recipients, msg.as_string())
517
        mailServer.sendmail("5h0p2o2o", recipients, msg.as_string())
518
    except Exception as e:
518
    except Exception as e:
519
        print e
519
        print e
520
        print "Unable to send return .Lets try with local SMTP."
520
        print "Unable to send return .Lets try with local SMTP."
521
        smtpServer = smtplib.SMTP('localhost')
521
        smtpServer = smtplib.SMTP('localhost')
522
        smtpServer.set_debuglevel(1)
522
        smtpServer.set_debuglevel(1)
523
        sender = 'build@shop2020.in'
523
        sender = 'cnc.center@shop2020.in'
524
        try:
524
        try:
525
            smtpServer.sendmail(sender, recipients, msg.as_string())
525
            smtpServer.sendmail(sender, recipients, msg.as_string())
526
            print "Successfully sent email"
526
            print "Successfully sent email"
527
        except:
527
        except:
528
            print "Error: unable to send email."
528
            print "Error: unable to send email."