Skip to content
Merged
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
3 changes: 2 additions & 1 deletion ckanext/subscribe/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def _mail_recipient(

def _mail_payload(msg, mail_from, recipient_email):
# Send the email using Python's smtplib.
smtp_connection = smtplib.SMTP()
if "smtp.test_server" in config:
# If 'smtp.test_server' is configured we assume we're running tests,
# and don't use the smtp.server, starttls, user, password etc. options.
Expand All @@ -77,6 +76,8 @@ def _mail_payload(msg, mail_from, recipient_email):
smtp_user = config.get("smtp.user")
smtp_password = config.get("smtp.password")

smtp_connection = smtplib.SMTP(smtp_server)

try:
smtp_connection.connect(smtp_server)
except socket.error as e:
Expand Down
Loading