Subversion Repositories SmartDukaan

Rev

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

Rev 16443 Rev 16444
Line 99... Line 99...
99
            
99
            
100
        try:
100
        try:
101
            
101
            
102
            if 'profitmandi.com' in mail.emailFrom:
102
            if 'profitmandi.com' in mail.emailFrom:
103
                self.authenticate("profitmandi","pma20aug")
103
                self.authenticate("profitmandi","pma20aug")
104
                self.setMailServerAndPassword(mail)
104
                self.setMailServerAndPassword(mail, "pma20aug")
105
                rs = self.mailServer.sendmail("pma20aug", mail.emailTo + mail.cc + mail.bcc, msg.as_string())
105
                rs = self.mailServer.sendmail(self.password, mail.emailTo + mail.cc + mail.bcc, msg.as_string())
106
            else:
106
            else:
107
                self.authenticate()
107
                self.authenticate()
108
                self.setMailServerAndPassword(mail)
108
                self.setMailServerAndPassword(mail)
109
                rs = self.mailServer.sendmail(self.password, mail.emailTo + mail.cc + mail.bcc + ['backup@saholic.com'], msg.as_string())
109
                rs = self.mailServer.sendmail(self.password, mail.emailTo + mail.cc + mail.bcc + ['backup@saholic.com'], msg.as_string())
110
        except smtplib.SMTPServerDisconnected as e:
110
        except smtplib.SMTPServerDisconnected as e:
Line 114... Line 114...
114
        
114
        
115
        print msg['To']
115
        print msg['To']
116
        # Should be mailServer.quit(), but that crashes...
116
        # Should be mailServer.quit(), but that crashes...
117
        return rs
117
        return rs
118
 
118
 
119
    def setMailServerAndPassword(self, mail):
119
    def setMailServerAndPassword(self, mail, password="shop2020"):
120
        self.mailServer = self.sendGridMailServer
120
        self.mailServer = self.sendGridMailServer
121
        self.password = self.sendGridPassword
121
        self.password = password
122
        
122
        
123
#        self.mailServer = self.gmailServer
123
#        self.mailServer = self.gmailServer
124
#        self.password = self.gmailPassword
124
#        self.password = self.gmailPassword
125
#
125
#
126
#        for receiver in mail.to:
126
#        for receiver in mail.to: