Subversion Repositories SmartDukaan

Rev

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

Rev 766 Rev 873
Line 28... Line 28...
28
    if not mail:
28
    if not mail:
29
        raise HelperServiceException(101, "mail not present")
29
        raise HelperServiceException(101, "mail not present")
30
    #msg = MIMEMultipart()
30
    #msg = MIMEMultipart()
31
    #mail = Mail()
31
    #mail = Mail()
32
    msg = MIMEText(mail.data)
32
    msg = MIMEText(mail.data)
-
 
33
    msg['To'] = "help@saholic.com"
33
    msg['From'] = mail.sender
34
    msg['From'] = "help@saholic.com"
34
    msg['Subject'] = mail.subject
35
    msg['Subject'] = mail.subject
35
    #msg.attach(mail.data)
36
    #msg.attach(mail.data)
36
    
37
    
37
    #handle attachments in mail
38
    #handle attachments in mail
38
    if mail.attachments:
39
    if mail.attachments:
Line 44... Line 45...
44
            part.add_header('Content-Disposition',
45
            part.add_header('Content-Disposition',
45
                    'attachment; filename="%s"' % os.path.basename(attach))
46
                    'attachment; filename="%s"' % os.path.basename(attach))
46
            msg.attach(part)
47
            msg.attach(part)
47
     
48
     
48
    for to in mail.to:
49
    for to in mail.to:
-
 
50
        #to
49
        msg['To'] = to
51
        msg['To'] = "help@saholic.com"
-
 
52
        mail.sender = "help@shop2020.in"
50
        
53
        mail.password = "5h0p2o2o"
51
        mailServer = smtplib.SMTP("smtp.gmail.com", 587)
54
        mailServer = smtplib.SMTP("smtp.gmail.com", 587)
52
        mailServer.ehlo()
55
        mailServer.ehlo()
53
        mailServer.starttls()
56
        mailServer.starttls()
54
        mailServer.ehlo()
57
        mailServer.ehlo()
55
        mailServer.login(mail.sender, mail.password)
58
        mailServer.login(mail.sender, mail.password)