通过 zoho 发送 SMTP 邮件时出现连接超时错误



当我尝试通过 SMTP 发送 django 邮件时出现连接超时错误。以下是我的配置 -

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Host for sending e-mail.
EMAIL_HOST = 'smtp.zoho.com'
# Port for sending e-mail.
EMAIL_PORT = 587
# Optional SMTP authentication information for EMAIL_HOST.
EMAIL_HOST_USER = 'cs@amaze.com'
EMAIL_HOST_PASSWORD = 'amaze123'
EMAIL_USE_TLS = True

我使用的代码是:

    from django.core.mail import send_mail
    >>> send_mail('Order Confirmation', 'Order placed successfuly', 
'cs@amaze.com', ['check@gmail.com'])

错误-

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py", li                                                                                        ne 61, in send_mail
    return mail.send()
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", lin                                                                                        e 292, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py                                                                                        ", line 100, in send_messages
    new_conn_created = self.open()
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py                                                                                        ", line 58, in open
    self.connection = connection_class(self.host, self.port, **connection_params                                                                                        )
  File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 316, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 110] Connection timed out
是否确实

需要使用 TLS 而不是 SSL,如果需要,是否在电子邮件帐户上启用 smtp?

相关内容

  • 没有找到相关文章

最新更新