发送邮件,在本地没问题,部署到服务器无法发邮件
来源:14-3 uwsgi配置文件方式启动以及代码更新后的重启
Brook_StudyMachine
2017-05-03
在本地,发送邮件没有问题,部署到阿里云服务器,系统centos6.5
无法发送邮件
使用25端口发送邮件时,超时
在本地telnet任何smtp都是有响应的,163,新浪等。在服务器telnet25都超时
改用465端口加密发邮件。在本机测试也没问题,可以发送。
但是部署到服务器,会返回错误
Traceback (most recent call last): File "<console>", line 1, in <module> File "/root/.virtualenvs/django/lib/python2.7/site-packages/django/core/mail/__init__.py", line 61, in send_mail return mail.send() File "/root/.virtualenvs/django/lib/python2.7/site-packages/django/core/mail/message.py", line 292, in send return self.get_connection(fail_silently).send_messages([self]) File "/root/.virtualenvs/django/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 100, in send_messages new_conn_created = self.open() File "/root/.virtualenvs/django/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 58, in open self.connection = connection_class(self.host, self.port, **connection_params) File "/usr/local/python/lib/python2.7/smtplib.py", line 256, in __init__ (code, msg) = self.connect(host, port) File "/usr/local/python/lib/python2.7/smtplib.py", line 317, in connect (code, msg) = self.getreply() File "/usr/local/python/lib/python2.7/smtplib.py", line 368, in getreply raise SMTPServerDisconnected("Connection unexpectedly closed") SMTPServerDisconnected: Connection unexpectedly closed
465邮箱配置如图,我在本地发邮件是没有问题的。
写回答
1回答
-
Brook_StudyMachine
提问者
2017-05-04
阿里服务器不允许25端口连smtp
465配置没有问题,后来重启服务器莫名其妙好了
132018-02-19
相似问题