Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django发送邮件和交换服务器_Python_Django_Email_Exchange Server - Fatal编程技术网

Python Django发送邮件和交换服务器

Python Django发送邮件和交换服务器,python,django,email,exchange-server,Python,Django,Email,Exchange Server,目前,我有一台Exchange服务器正在运行,正在尝试运行send_mail,但会出现各种错误 这是我的当前设置.py EMAIL_HOST = 'exchange.domain.com' EMAIL_HOST_USER = 'DOMAIN\user' EMAIL_HOST_PASSWORD = 'password' EMAIL_PORT = 443 EMAIL_USE_TLS = True 当我运行发送邮件时('Subject','Message','myemail@domain.com',

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

这是我的当前设置.py

EMAIL_HOST = 'exchange.domain.com'
EMAIL_HOST_USER = 'DOMAIN\user'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 443
EMAIL_USE_TLS = True
当我运行
发送邮件时('Subject','Message','myemail@domain.com', ['otheremail@domain.com“,]”,失败(默认为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
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/Library/Python/2.7/site packages/django/core/mail/_init__.py”,第62行,在发送邮件中
连接=连接)。发送()
文件“/Library/Python/2.7/site packages/django/core/mail/message.py”,第255行,在send中
返回self.get\u连接(以静默方式失败)。发送消息([self])
文件“/Library/Python/2.7/site packages/django/core/mail/backends/smtp.py”,第88行,在send_messages中
新建连接创建=self.open()
文件“/Library/Python/2.7/site packages/django/core/mail/backends/smtp.py”,第49行,打开
本地\u主机名=DNS\u名称。获取\u fqdn()
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py”,第250行,在__
(代码,消息)=自连接(主机,端口)
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py”,第311行,在connect中
(代码,msg)=self.getreply()
文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py”,第359行,在getreply中
+str(e))
SMTPServerDisconnected:连接意外关闭:[Errno 54]对等方重置连接

我无意中从outlook中获取了配置信息并使用了它,我注释掉了端口行并将用户改为“用户名”而不是“域\用户”。您确定端口443正确吗?端口443通常用于ssl上的https,而不是发送电子邮件。@Astraub最终解决了这个问题吗?嗨,你最终解决了这个问题吗?我想知道解决办法