Created
December 18, 2019 16:06
-
-
Save cybertramp/6d72475c17be43b3f7a6b95592689b10 to your computer and use it in GitHub Desktop.
Python3 mail bot
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
| # You need python3 | |
| # Python mail bot | |
| # 2017 - paran_son@outlook.com | |
| import smtplib | |
| def prompt(prompt): | |
| return input(prompt).strip() | |
| fromaddr = '보내는이 주소' | |
| toaddrs = '받는이 주소' | |
| print("input message, end with ^D (Unix) or ^Z (Windows):") | |
| # Add the From: and To: headers at the start! | |
| msg = ("From: %s\r\nTo: %s\r\n\r\n"% (fromaddr, ", ".join(toaddrs))) | |
| msg = msg + "test message" | |
| print("Message length is", len(msg)) | |
| #import pdb; pdb.set_trace() | |
| server = smtplib.SMTP_SSL('smtp주소',465) | |
| server.connect('smtp주소','465') | |
| server.login('ID','PW') | |
| #erver.set_debuglevel(1) | |
| server.sendmail(fromaddr,toaddrs, msg) | |
| server.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment