Commit 13d325e2 authored by ibuler's avatar ibuler

捕捉smtp异常

parent 79994e13
...@@ -6,7 +6,7 @@ import time ...@@ -6,7 +6,7 @@ import time
import os import os
import sys import sys
import MySQLdb import MySQLdb
from smtplib import SMTP, SMTPAuthenticationError, SMTPConnectError from smtplib import SMTP, SMTPAuthenticationError, SMTPConnectError, SMTPSenderRefused
import ConfigParser import ConfigParser
import socket import socket
import fcntl import fcntl
...@@ -127,7 +127,7 @@ class PreSetup(object): ...@@ -127,7 +127,7 @@ class PreSetup(object):
smtp.quit() smtp.quit()
return True return True
except (SMTPAuthenticationError, socket.timeout, socket.gaierror), e: except (SMTPAuthenticationError, socket.timeout, socket.gaierror, SMTPSenderRefused, SMTPConnectError), e:
color_print(e, 'red') color_print(e, 'red')
return False return False
......
...@@ -19,5 +19,5 @@ email_host = smtp.qq.com ...@@ -19,5 +19,5 @@ email_host = smtp.qq.com
email_port = 25 email_port = 25
email_host_user = xxxxxxxx@qq.com email_host_user = xxxxxxxx@qq.com
email_host_password = xxxxxx email_host_password = xxxxxx
email_use_tls = True email_use_tls = False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment