Subversion Repositories SmartDukaan

Rev

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

Rev 22397 Rev 22469
Line 65... Line 65...
65
        part.add_header('Content-Disposition', 'attachment; filename=%s' % filename + "-insurance-policy.pdf")
65
        part.add_header('Content-Disposition', 'attachment; filename=%s' % filename + "-insurance-policy.pdf")
66
        return part
66
        return part
67
 
67
 
68
    def sendMail(self, mail):
68
    def sendMail(self, mail):
69
        msg = MIMEMultipart()
69
        msg = MIMEMultipart()
70
        if mail.emailFrom is not None and not mail.emailFrom and mail.emailFrom.strip() != "" :
70
        if mail.emailFrom is not None and mail.emailFrom.strip() != "" :
71
            if 'profitmandi.com' in mail.emailFrom:
71
            if 'profitmandi.com' in mail.emailFrom:
72
                msg['From'] = "ProfitMandi <help@profitmandi.com>"
72
                msg['From'] = "ProfitMandi <help@profitmandi.com>"
73
            else:
73
            else:
74
                msg['From'] = mail.emailFrom
74
                msg['From'] = mail.emailFrom
75
        else:
75
        else:
Line 99... Line 99...
99
                document = tclient.getDocument(1, int(mail.source))
99
                document = tclient.getDocument(1, int(mail.source))
100
                if document != bin(0):
100
                if document != bin(0):
101
                    msg.attach(self.get_attachment_part(document, mail.source))
101
                    msg.attach(self.get_attachment_part(document, mail.source))
102
            
102
            
103
        try:
103
        try:
104
            
104
            #Temporary allowing email sender to send only through profitmandi domain
105
            if 'profitmandi.com' in mail.emailFrom:
105
            #if 'profitmandi.com' in mail.emailFrom:
-
 
106
            if False:
106
                self.authenticate("profitmandi","pma20aug")
107
                self.authenticate("profitmandi_key_new","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")
107
                self.setMailServerAndPassword(mail, "pma20aug")
108
                self.setMailServerAndPassword(mail, "pma20aug")
108
                rs = self.mailServer.sendmail(self.password, mail.emailTo + mail.cc + mail.bcc, msg.as_string())
109
                rs = self.mailServer.sendmail(self.password, mail.emailTo + mail.cc + mail.bcc, msg.as_string())
109
            else:
110
            else:
110
                self.authenticate()
111
                self.authenticate()
111
                self.setMailServerAndPassword(mail)
112
                self.setMailServerAndPassword(mail)