Django send_mail和Exchange服务器

时间:2014-07-10 19:00:45

标签: python django email exchange-server

目前我有一台Exchange服务器正在运行并尝试运行send_mail,但会出现各种错误。

这是我当前的settings.py

EMAIL_HOST = 'exchange.domain.com'
EMAIL_HOST_USER = 'DOMAIN\user'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 443
EMAIL_USE_TLS = True

当我运行send_mail('''Subject''', '''Message.''', 'myemail@domain.com', ['otheremail@domain.com',], fail_silently=False)

时 在非常漫长的等待

之后

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/django/core/mail/__init__.py", line 62, in send_mail
    connection=connection).send()
  File "/Library/Python/2.7/site-packages/django/core/mail/message.py", line 255, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/Library/Python/2.7/site-packages/django/core/mail/backends/smtp.py", line 88, in send_messages
    new_conn_created = self.open()
  File "/Library/Python/2.7/site-packages/django/core/mail/backends/smtp.py", line 49, in open
    local_hostname=DNS_NAME.get_fqdn())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 250, in __init__
    (code, msg) = self.connect(host, port)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 311, in connect
    (code, msg) = self.getreply()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 359, in getreply
    + str(e))
SMTPServerDisconnected: Connection unexpectedly closed: [Errno 54] Connection reset by peer

0 个答案:

没有答案