V5 Outgoing email not going

Hi,

Outgoing email not working in v5.

Sunil

I was referring https://discuss.frappe.io/t/v5-0-smpt-confusion/3926 but I think thread is still unsolved.

Neither Gmail nor Mandrill is working with v5. Can you pls help.

Sunil

It is not going for me either.

Do you see an exception? Its working for us.

Check the scheduler log / error log.

By any chance, are you trying to send it yourself? Try sending it to another email address and see if that works.

Yes, I was checking by sending on own ID. When I tried sending on others - its delivered but takes huge time.

With same v4 & mandrill configuration, mails are getting delivered within second. awesome:) From usability and design perspective, still v4 rocks.

Mail error log says

Apr 27 05:15:42 nescodeerp postfix/smtpd[51987]: warning: hostname hn.kd.ny.adsl does not resolve to address 182.118.53.37: Name or service not known
Apr 27 05:15:42 nescodeerp postfix/smtpd[51987]: connect from unknown[182.118.53.37]
Apr 27 05:15:42 nescodeerp postfix/smtpd[51987]: warning: non-SMTP command from unknown[182.118.53.37]: GET / HTTP/1.0
Apr 27 05:15:42 nescodeerp postfix/smtpd[51987]: disconnect from unknown[182.118.53.37]
Apr 27 05:19:02 nescodeerp postfix/anvil[51995]: statistics: max connection rate 1/60s for (smtp:182.118.53.37) at Apr 27 05:15:42
Apr 27 05:19:02 nescodeerp postfix/anvil[51995]: statistics: max connection count 1 for (smtp:182.118.53.37) at Apr 27 05:15:42
Apr 27 05:19:02 nescodeerp postfix/anvil[51995]: statistics: max cache size 1 at Apr 27 05:15:42
Apr 27 10:21:34 nescodeerp postfix/smtpd[56701]: connect from researchscan136.eecs.umich.edu[141.212.121.136]
Apr 27 10:21:35 nescodeerp postfix/smtpd[56701]: lost connection after STARTTLS from researchscan136.eecs.umich.edu[141.212.121.136]
Apr 27 10:21:35 nescodeerp postfix/smtpd[56701]: disconnect from researchscan136.eecs.umich.edu[141.212.121.136]
Apr 27 10:24:56 nescodeerp postfix/anvil[56711]: statistics: max connection rate 1/60s for (smtp:141.212.121.136) at Apr 27 10:21:34
Apr 27 10:24:56 nescodeerp postfix/anvil[56711]: statistics: max connection count 1 for (smtp:141.212.121.136) at Apr 27 10:21:34
Apr 27 10:24:56 nescodeerp postfix/anvil[56711]: statistics: max cache size 1 at Apr 27 10:21:34
Apr 27 17:15:16 nescodeerp postfix/smtpd[60809]: connect from unknown[202.100.91.157]
Apr 27 17:15:16 nescodeerp postfix/smtpd[60809]: lost connection after CONNECT from unknown[202.100.91.157]
Apr 27 17:15:16 nescodeerp postfix/smtpd[60809]: disconnect from unknown[202.100.91.157]
Apr 27 17:18:36 nescodeerp postfix/anvil[60817]: statistics: max connection rate 1/60s for (smtp:202.100.91.157) at Apr 27 17:15:16
Apr 27 17:18:36 nescodeerp postfix/anvil[60817]: statistics: max connection count 1 for (smtp:202.100.91.157) at Apr 27 17:15:16
Apr 27 17:18:36 nescodeerp postfix/anvil[60817]: statistics: max cache size 1 at Apr 27 17:15:16
Apr 27 19:15:15 nescodeerp postfix/smtpd[61840]: connect from unknown[61.240.144.67]
Apr 27 19:15:16 nescodeerp postfix/smtpd[61840]: SSL_accept error from unknown[61.240.144.67]: lost connection
Apr 27 19:15:16 nescodeerp postfix/smtpd[61840]: lost connection after STARTTLS from unknown[61.240.144.67]
Apr 27 19:15:16 nescodeerp postfix/smtpd[61840]: disconnect from unknown[61.240.144.67]
Apr 27 19:18:37 nescodeerp postfix/anvil[61848]: statistics: max connection rate 1/60s for (smtp:61.240.144.67) at Apr 27 19:15:15
Apr 27 19:18:37 nescodeerp postfix/anvil[61848]: statistics: max connection count 1 for (smtp:61.240.144.67) at Apr 27 19:15:15
Apr 27 19:18:37 nescodeerp postfix/anvil[61848]: statistics: max cache size 1 at Apr 27 19:15:15
Apr 29 05:39:59 nescodeerp postfix/smtpd[19363]: warning: hostname hn.kd.ny.adsl does not resolve to address 182.118.45.237: Name or service not known
Apr 29 05:39:59 nescodeerp postfix/smtpd[19363]: connect from unknown[182.118.45.237]
Apr 29 05:39:59 nescodeerp postfix/smtpd[19363]: warning: non-SMTP command from unknown[182.118.45.237]: GET / HTTP/1.0
Apr 29 05:39:59 nescodeerp postfix/smtpd[19363]: disconnect from unknown[182.118.45.237]
Apr 29 05:43:19 nescodeerp postfix/anvil[19371]: statistics: max connection rate 1/60s for (smtp:182.118.45.237) at Apr 29 05:39:59
Apr 29 05:43:19 nescodeerp postfix/anvil[19371]: statistics: max connection count 1 for (smtp:182.118.45.237) at Apr 29 05:39:59
Apr 29 05:43:19 nescodeerp postfix/anvil[19371]: statistics: max cache size 1 at Apr 29 05:39:59

Hello,

I know is an old thread, others threads that talk about similar issues was closed with no responses, so I will put it here, if I need to open another topic, please inform me and I will

Exact same issue on occurred on v6.27.15., more specifically using as SMTP a postfix on port 465, here are the logs from the mail server side:

May  2 12:53:46 mailserver postfix/smtps/smtpd[10116]: connect from 33.ip-149-56-133.net[149.56.133.33]
May  2 13:10:01 mailserver postfix/smtps/smtpd[10773]: SSL_accept error from 33.ip-149-56-133.net[149.56.133.33]: lost connection
May  2 13:10:01 mailserver postfix/smtps/smtpd[10773]: lost connection after CONNECT from 33.ip-149-56-133.net[149.56.133.33]
May  2 13:10:01 mailserver postfix/smtps/smtpd[10773]: disconnect from 33.ip-149-56-133.net[149.56.133.33]

I had the same issue with a Django application, but I just changed the line in a static configuration, using ERPNext/Celery classes equivalent, from:

use_tls=self.conf.EMAIL_USE_TLS,

to:

use_ssl=self.conf.EMAIL_USE_SSL

But on GUI there is just one check box Use TLS,

So the question is, there is some way to specify not use TLS but instead SSL from smtplib?

I think that will solve the issue.

The exact same issue is described better here

Update:

I did some change to frappe-bench/apps/frappe/frappe/email/smtp.py, to match my scenario:

import smtp
from smtplib import SMTP_SSL as SMTPSSL # add this line


class SMTPSERVER:
     ...
     @property
     def sess(self):
         ...
         try:
                        if self.use_ssl and not self.port:
                                self.port = 587

                        #self._sess = smtplib.SMTP((self.server or "").encode('utf-8'), # delete this line
                        self._sess = SMTPSSL((self.server or "").encode('utf-8'),         # add this line
                                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_ssl:
                                self._sess.ehlo()
                                self._sess.starttls()
                                self._sess.ehlo()