リビジョン | 176b8405c3554d5eda9aa9ef4f8211ce39eb100b (tree) |
---|---|
日時 | 2008-10-27 20:11:18 |
作者 | iselllo |
コミッター | iselllo |
Python script allowing simple email sending using libgmail (hence it works only for gmail).
@@ -0,0 +1,19 @@ | ||
1 | +import libgmail | |
2 | +from getpass import getpass | |
3 | + | |
4 | +account = raw_input("Enter your account name: ") | |
5 | +password = getpass("Password: ") | |
6 | +to = raw_input("Enter the address to send mail to: ") | |
7 | +subject = raw_input("Enter a subject: ") | |
8 | +message = raw_input("Enter the message: ") | |
9 | + | |
10 | +account = libgmail.GmailAccount(account, password) | |
11 | + | |
12 | +account.login() | |
13 | +gmessage = libgmail.GmailComposedMessage(to, subject, message) | |
14 | + | |
15 | +if account.sendMessage(gmessage): | |
16 | + print "Message sent successfully" | |
17 | +else: | |
18 | + print "Error sending message" | |
19 | + |