Subversion Repositories SmartDukaan

Rev

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

Rev 7721 Rev 7722
Line 181... Line 181...
181
    mailServer.starttls()
181
    mailServer.starttls()
182
    mailServer.ehlo()
182
    mailServer.ehlo()
183
    
183
    
184
    # Create the container (outer) email message.
184
    # Create the container (outer) email message.
185
    msg = MIMEMultipart()
185
    msg = MIMEMultipart()
186
    msg['Subject'] = SUBJECT
186
    msg['Subject'] = SUBJECT + ' for ' + email
187
    msg['From'] = "ClusterWiseReport@saholic.com"
187
    msg['From'] = "ClusterWiseReport@saholic.com"
188
    msg['To'] = 'cluster-heads@saholic.com'
188
    msg['To'] = 'cluster-heads@saholic.com'
189
    msg.preamble = SUBJECT
189
    msg.preamble = SUBJECT + ' for ' + email
190
    html_msg = MIMEText(message, 'html')
190
    html_msg = MIMEText(message, 'html')
191
    msg.attach(html_msg)
191
    msg.attach(html_msg)
192
    
192
    
193
    fileMsg = MIMEBase('application','vnd.ms-excel')
193
    fileMsg = MIMEBase('application','vnd.ms-excel')
194
    fileMsg.set_payload(file(TMP_FILE).read())
194
    fileMsg.set_payload(file(TMP_FILE).read())
195
    encoders.encode_base64(fileMsg)
195
    encoders.encode_base64(fileMsg)
196
    fileMsg.add_header('Content-Disposition','attachment;filename=recharge-report-for-week-ending-on-' + date.today().isoformat() + '.xls')
196
    fileMsg.add_header('Content-Disposition','attachment;filename=recharge-report-for-week-ending-on-' + date.today().isoformat() + '.xls')
197
    msg.attach(fileMsg)
197
    msg.attach(fileMsg)
198
    
198
    
199
    MAILTO = [email, 'anupam.singh@shop2020.in']
199
    MAILTO = [email, 'anupam.singh@shop2020.in', 'ashwani.kumar@spiceretail.co.in', 'gagan.sharma@spiceretail.co.in']
200
    mailServer.login(SENDER, PASSWORD)
200
    mailServer.login(SENDER, PASSWORD)
201
    mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
201
    mailServer.sendmail(PASSWORD, MAILTO, msg.as_string())
202
 
202
 
203
def main():
203
def main():
204
    getProductSaleData()
204
    getProductSaleData()