在本地,发送邮件没有问题,部署到阿里云服务器,系统centos6.5
无法发送邮件
使用25端口发送邮件时,超时
在本地telnet任何smtp都是有响应的,163,新浪等。在服务器telnet25都超时
改用465端口加密发邮件。在本机测试也没问题,可以发送。
但是部署到服务器,会返回错误
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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邮箱配置如图,我在本地发邮件是没有问题的。
登录后可查看更多问答,登录/注册