diff --git a/mailproxy.py b/mailproxy.py index 7dbed8d..d9c55b7 100644 --- a/mailproxy.py +++ b/mailproxy.py @@ -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() @@ -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()) @@ -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 = { @@ -87,7 +87,7 @@ def _deliver(self, envelope): } else: auth = None - + controller = Controller( MailProxyHandler( host=config.get('remote', 'host'),