def mailContent(site,subs,dLOPath,cats): if site == 'BLG': msg = MIMEMultipart() msg['Subject'] = subs if cats == 'TODAY': dLOF = getAttName(site) elif cats == 'YESTERDAY': dLOF = getAttNameYtd(site) att = mailAttachment(dLOPath,dLOF) msg.attach(att) return msg else: msg = MIMEMultipart() msg['Subject'] = subs hMin1 = 'LO_OPEN_H-1.xlsx' ms2 = 'PlanMs2.xlsx' if cats == 'TODAY': hMin1F,ms2F,dLOF = getAttName(site) elif cats == 'YESTERDAY': hMin1F, ms2F, dLOF = getAttNameYtd(site) att1 = mailAttachment(hMin1,hMin1F) att2 = mailAttachment(ms2,ms2F) att3 = mailAttachment(dLOPath,dLOF) attachment = [att1,att2,att3] [msg.attach(i) for i in attachment] return msg
def mailContent2(subs,DLOPath,outPath,planPath): likeRightNow = getDashDate() msg = MIMEMultipart() msg['Subject'] = subs outName = 'Outstanding JBB %s.xlsx' % likeRightNow planName= 'Plan Ms2 JBB %s.xlsx' % likeRightNow DLOName = 'DataLO JBB %s.xls' % likeRightNow att1 = mailAttachment(outPath,outName) att2 = mailAttachment(planPath,planName) att3 = mailAttachment(DLOPath,DLOName) attachment = [att1,att2,att3] [msg.attach(i) for i in attachment] return msg
def content(textPath5, textPath6): today = getNow() dataLOFormat = today.strftime('%d%b%Y') thisHour = today.strftime('%H') namaFile = 'DATA_LO DAN LO_OPEN {0} Pukul {1}.00'.format( dataLOFormat, thisHour) msg = MIMEMultipart() msg['Subject'] = namaFile # xlsxAttachment # attach dataLO att1 = mailAttachment(textPath5, os.path.basename(textPath5)) att2 = mailAttachment(textPath6, os.path.basename(textPath6)) attachment = [att1, att2] [msg.attach(i) for i in attachment] return msg
def mailContentNota(pdfPath, nomerNota): namaFile = 'NOTA %s PLP' % nomerNota msg = MIMEMultipart() msg['Subject'] = namaFile stageName = 'NOTA %s PLP.pdf' att1 = mailAttachment(pdfPath, stageName) msg.attach(att1) return msg
def mailContentNota(pdfPath, nomerNota, site): namaFile = 'NOTA {0} {1}'.format(nomerNota, site) msg = MIMEMultipart() msg['Subject'] = namaFile stageName = 'NOTA {0} {1}.pdf'.format(nomerNota, site) att1 = mailAttachment(pdfPath, stageName) msg.attach(att1) return msg