Created
April 16, 2013 15:39
-
-
Save smirn0v/5396980 to your computer and use it in GitHub Desktop.
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
#!/opt/local/bin/python | |
# Import smtplib for the actual sending function | |
import smtplib | |
import sys | |
# Import the email modules we'll need | |
from email.mime.text import MIMEText | |
if len(sys.argv) < 4: | |
sys.stderr.write('Usage: %s <to email> <subject> <body>\n'%sys.argv[0]) | |
sys.exit(1) | |
msg = MIMEText(" ".join(sys.argv[3:])) | |
# me == the sender's email address | |
# you == the recipient's email address | |
msg['Subject'] = sys.argv[2] | |
msg['From'] = "Alexander Smirnov <alexandr.smirnov@corp.mail.ru>" | |
msg['To'] = sys.argv[1] | |
# Send the message via our own SMTP server, but don't include the | |
# envelope header. | |
s = smtplib.SMTP_SSL('smtp.mail.ru') | |
#s.set_debuglevel(1) | |
s.login("login","password") | |
s.sendmail("login", sys.argv[1], msg.as_string()) | |
s.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment