Created
April 6, 2020 20:52
-
-
Save catichenor/c86c1b4cbd4b67eb8d28108b2641f7d6 to your computer and use it in GitHub Desktop.
How to authenticate to yagmail on an SMTP server without authentication
This file contains 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
# Couldn't find a reference on how to authenticate to an SMTP server that doesn't require authentication, but this worked. | |
# Based on the yagmail PyPi page: https://pypi.org/project/yagmail/ | |
# and yagmail docs: https://yagmail.readthedocs.io/en/latest/api.html#smtp-client | |
import yagmail | |
user_email = "[email protected]" | |
yag = yagmail.SMTP(user=user_email, host='smtp.somedomain.com', port=25, smtp_skip_login=True, smtp_ssl=False) | |
contents = [ | |
"This is the body, and here is just text http://somedomain/image.png", | |
"You can find an audio file attached.", '/local/path/to/song.mp3' | |
] | |
yag.send('[email protected]', 'Testing', contents) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment