Skip to content

Instantly share code, notes, and snippets.

@gduverger
Last active March 21, 2019 11:32
Show Gist options
  • Save gduverger/65acedd208a6ef468333bd32d1303f50 to your computer and use it in GitHub Desktop.
Save gduverger/65acedd208a6ef468333bd32d1303f50 to your computer and use it in GitHub Desktop.
import smtplib
import ssl
SENDER_EMAIL = '[email protected]'
RECEIVER_EMAIL = '[email protected]'
SERVER_API_TOKEN = '…'
for host in ['legacy-smtp.postmarkapp.com', 'smtp.postmarkapp.com', 'future-smtp.postmarkapp.com']:
for port in [25, 2525, 587]:
context = ssl.create_default_context()
with smtplib.SMTP(host, port) as server:
print(server.noop())
server.ehlo()
server.starttls(context=context)
server.ehlo()
server.login(SERVER_API_TOKEN, SERVER_API_TOKEN)
server.sendmail(SENDER_EMAIL, RECEIVER_EMAIL, f'host={host} port={port}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment