Last active
March 21, 2019 11:32
-
-
Save gduverger/65acedd208a6ef468333bd32d1303f50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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