Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error server_hostname cannot be an empty string #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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