Subversion Repositories SmartDukaan

Rev

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

Rev 20376 Rev 21135
Line 9... Line 9...
9
from email.mime.multipart import MIMEMultipart
9
from email.mime.multipart import MIMEMultipart
10
from BeautifulSoup import BeautifulSoup
10
from BeautifulSoup import BeautifulSoup
11
from dtr.utils.utils import ungzipResponse
11
from dtr.utils.utils import ungzipResponse
12
import json
12
import json
13
import chardet
13
import chardet
-
 
14
from shop2020.utils.EmailAttachmentSender import get_attachment_part
-
 
15
from shop2020.utils import EmailAttachmentSender
14
 
16
 
15
con = None
17
con = None
16
parser = optparse.OptionParser()
18
parser = optparse.OptionParser()
17
parser.add_option("-m", "--m", dest="mongoHost",
19
parser.add_option("-m", "--m", dest="mongoHost",
18
                      default="localhost",
20
                      default="localhost",
Line 237... Line 239...
237
        except:
239
        except:
238
            pass
240
            pass
239
    message+="""</tbody></table></body></html>"""
241
    message+="""</tbody></table></body></html>"""
240
    print message
242
    print message
241
    #recipients = ['kshitij.sood@saholic.com']
243
    #recipients = ['kshitij.sood@saholic.com']
242
    recipients = ['rajneesh.arora@saholic.com','kshitij.sood@saholic.com','chaitnaya.vats@saholic.com','ritesh.chauhan@saholic.com','khushal.bhatia@saholic.com']
244
    recipients = ['kshitij.sood@saholic.com','ritesh.chauhan@saholic.com','aishwarya.singh@saholic.com']
243
    msg = MIMEMultipart()
-
 
244
    msg['Subject'] = "Snapdeal Best Sellers" + ' - ' + str(datetime.now())
245
    EmailAttachmentSender.mail_send_grid("dtr@profitmandi.com","apikey", "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", recipients, "Snapdeal Best Sellers",message ,[],[],[])              
245
    msg['From'] = ""
-
 
246
    msg['To'] = ",".join(recipients)
-
 
247
    msg.preamble = "Snapdeal Best Sellers" + ' - ' + str(datetime.now())
-
 
248
    html_msg = MIMEText(message, 'html')
-
 
249
    msg.attach(html_msg)
-
 
250
    
-
 
251
    smtpServer = smtplib.SMTP('localhost')
-
 
252
    smtpServer.set_debuglevel(1)
-
 
253
    sender = 'dtr@shop2020.in'
-
 
254
    try:
-
 
255
        smtpServer.sendmail(sender, recipients, msg.as_string())
-
 
256
        print "Successfully sent email"
-
 
257
    except:
-
 
258
        print "Error: unable to send email."
-
 
259
            
-
 
260
            
246
            
261
 
247
 
262
def main():
248
def main():
263
    import time
249
    import time
264
    scrapeBestSellerMobiles()
250
    scrapeBestSellerMobiles()