From 001d1421f8125ada8c8ddb619c1524e0b2a1f847 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Mon, 25 Jul 2016 23:42:51 +0530 Subject: [PATCH] Taking into consideration that password may not always be provided --- frappe/email/doctype/email_account/email_account.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index 845e82c315..6bd4c95ed6 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -93,30 +93,28 @@ class EmailAccount(Document): if self.enable_outgoing: if not self.smtp_server: frappe.throw(_("{0} is required").format("SMTP Server")) - if not self.password: - frappe.throw(_("{0} is required").format("Password")) server = SMTPServer(login = getattr(self, "login_id", None) \ or self.email_id, - password = self.get_password(), server = self.smtp_server, port = cint(self.smtp_port), use_ssl = cint(self.use_tls) ) + if self.password: + server.password = self.get_password() server.sess def get_server(self, in_receive=False): """Returns logged in POP3 connection object.""" - if not self.password: - frappe.throw(_("{0} is required").format("Password")) args = { "host": self.email_server, "use_ssl": self.use_ssl, "username": getattr(self, "login_id", None) or self.email_id, - "password": self.get_password(), "use_imap": self.use_imap } + if self.password: + args.password = self.get_password() if not args.get("host"): frappe.throw(_("{0} is required").format("Email Server"))