Subversion Repositories SmartDukaan

Rev

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

Rev 884 Rev 900
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'] = mail.to
33
    msg['To'] = ', '.join( mail.to )
34
    msg['From'] = "help@saholic.com"
34
    msg['From'] = "help@saholic.com"
35
    msg['Subject'] = (mail.subject).
35
    msg['Subject'] = mail.subject
36
    #msg.attach(mail.data)
36
    #msg.attach(mail.data)
37
    
37
    
38
    #handle attachments in mail
38
    #handle attachments in mail
39
    if mail.attachments:
39
    if mail.attachments:
40
        for attach in mail.attachments:
40
        for attach in mail.attachments:
Line 43... Line 43...
43
            part.set_payload(open(attach, 'rb').read())
43
            part.set_payload(open(attach, 'rb').read())
44
            encoders.encode_base64(part)
44
            encoders.encode_base64(part)
45
            part.add_header('Content-Disposition',
45
            part.add_header('Content-Disposition',
46
                    'attachment; filename="%s"' % os.path.basename(attach))
46
                    'attachment; filename="%s"' % os.path.basename(attach))
47
            msg.attach(part)
47
            msg.attach(part)
48
     
48
    
49
    for to in mail.to:
49
    for to in mail.to:
50
        msg['To'] = to
50
        msg['To'] = to
51
        mail.sender = "help@shop2020.in"
51
        mail.sender = "help@shop2020.in"
52
        mail.password = "5h0p2o2o"
52
        mail.password = "5h0p2o2o"
53
        mailServer = smtplib.SMTP("smtp.gmail.com", 587)
53
        mailServer = smtplib.SMTP("smtp.gmail.com", 587)