[Solved] email domain setup bypassing the Frozen SAVE, requested time out error

when save new email domain zoho.com.cn , the page is frozen and finally returned requested time out message, and the email domain can not be saved at all! per further study and testing, I got the following finding and workaround to fix my problem

Finding:

  • on my aliyun cloud, for both my 2 email domains zoho.com.cn and 163.com, smtplib.SMTP(host, port) always no responding or error, smtplib.SMTP_SSL(host, 465) works instead

  • in frappe/frappe/email/smtp.py, the connection made to email domain is by the following 2 lines
    server =smtplib.SMTP()
    server.starttls() // this line even does not work for smtplib.SMTP_SSL(), this line is not needed at all

my workaround solution:

  1. change the smtp.py file as following(from line 180)
    if self.use_tls:
    self._sess = smtplib.SMTP_SSL((self.server or “”).encode(‘utf-8’),
    cint(self.port) or None)
    if not self._sess:
    err_msg = _(‘Could not connect to outgoing email server’)
    frappe.msgprint(err_msg)
    raise frappe.OutgoingEmailError(err_msg)

     	#if self.use_tls:
     	#	self._sess.ehlo()
     	#	self._sess.starttls()
     	#	self._sess.ehlo()
    
  2. make sure for the new domain record, make sure use TLS checked, input port number 465.

  3. setup a new email account which activated outgoing and link to the above mentioned email domain

  4. in the mail client setting (e.g login to www.zoho.com.cn) activate POP3/IMAP/SMTP