def get_pop3(self, in_receive=False): """Returns logged in POP3 connection object.""" args = { "host": self.pop3_server, "use_ssl": self.use_ssl, "username": getattr(self, "login_id", None) or self.email_id, "password": self.password } if not self.pop3_server: frappe.throw(_("{0} is required").format("POP3 Server")) pop3 = POP3Server(frappe._dict(args)) try: pop3.connect() except error_proto, e: if in_receive and e.message == "-ERR authentication failed": # if called via self.receive and it leads to authentication error, disable incoming # and send email to system manager self.handle_incoming_connect_error(description=_( 'Authentication failed while receiving emails from Email Account {0}' .format(self.name))) return None else: frappe.throw(e.message)
def get_pop3(self): """Returns logged in POP3 connection object.""" args = { "host": self.pop3_server, "use_ssl": self.use_ssl, "username": self.email_id, "password": self.password } if not self.pop3_server: frappe.throw(_("{0} is required").format("POP3 Server")) pop3 = POP3Server(frappe._dict(args)) try: pop3.connect() except error_proto, e: frappe.throw(e.message)
def get_pop3(self): """Returns logged in POP3 connection object.""" args = { "host": self.pop3_server, "use_ssl": self.use_ssl, "username": getattr(self, "login_id", None) or self.email_id, "password": self.password, "use_imap":self.use_imap } if not self.pop3_server: frappe.throw(_("{0} is required").format("POP3 Server")) pop3 = POP3Server(frappe._dict(args)) try: pop3.connect() except (error_proto,imaplib.IMAP4.error) , e: frappe.throw(e.message)