Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions mailproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def _deliver(self, envelope):
refused = {}
try:
if self._use_ssl:
s = smtplib.SMTP_SSL()
s = smtplib.SMTP_SSL(self._host)
else:
s = smtplib.SMTP()
s = smtplib.SMTP(self._host)
s.connect(self._host, self._port)
if self._starttls:
s.starttls()
Expand All @@ -59,7 +59,7 @@ def _deliver(self, envelope):
except (OSError, smtplib.SMTPException) as e:
logging.exception('got %s', e.__class__)
# All recipients were refused. If the exception had an associated
# error code, use it. Otherwise, fake it with a SMTP 554 status code.
# error code, use it. Otherwise, fake it with a SMTP 554 status code.
errcode = getattr(e, 'smtp_code', 554)
errmsg = getattr(e, 'smtp_error', e.__class__)
raise smtplib.SMTPResponseException(errcode, errmsg.decode())
Expand All @@ -78,7 +78,7 @@ def _deliver(self, envelope):

config = configparser.ConfigParser()
config.read(config_path)

use_auth = config.getboolean('remote', 'smtp_auth', fallback=False)
if use_auth:
auth = {
Expand All @@ -87,7 +87,7 @@ def _deliver(self, envelope):
}
else:
auth = None

controller = Controller(
MailProxyHandler(
host=config.get('remote', 'host'),
Expand Down