本文整理汇总了Python中gmail.Gmail.send_email方法的典型用法代码示例。如果您正苦于以下问题:Python Gmail.send_email方法的具体用法?Python Gmail.send_email怎么用?Python Gmail.send_email使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gmail.Gmail
的用法示例。
在下文中一共展示了Gmail.send_email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Gmail
# 需要导入模块: from gmail import Gmail [as 别名]
# 或者: from gmail.Gmail import send_email [as 别名]
from account import Account
from gmail import Gmail
gmail = Gmail()
while True:
choice = input('1. Sign up\n2. Login\n')
if choice == '1':
new_account = Account()
elif choice == '2':
user_account = Account.login()
if user_account != None:
while True:
choice2 = input('1. Inbox\n2.Send Email\n')
if choice2 == '1':
inbx = gmail.inbox(user_account)
print(inbx)
choice3 = input('Enter the index of message to view (max {}) / -1 to go back: '.format(len(inbx)-1))
if int(choice3) == -1:
pass
else:
print(gmail.view_message(int(choice3),inbx))
elif choice2 == '2':
#to_email, msg, subject, user
t = input('To: ')
s = input('Subject: ')
m = input('Message: ')
gmail.send_email(t, m, s, user_account)
示例2: print
# 需要导入模块: from gmail import Gmail [as 别名]
# 或者: from gmail.Gmail import send_email [as 别名]
print("Checking for emails" + " "*(print_length-(len("Checking for emails"))), end="\r")
for received_email in gmail.get_unread():
print("Email received" + " "*(print_length-(len("Email received"))))
sender = received_email['From']
subject = received_email['Subject']
if any(email in sender for email in users):
added_torrent = find_torrent.search_and_download(subject)
print(" "*print_length)
print(sender + " "*(print_length-(len(sender))))
print(subject + " "*(print_length-(len(subject))))
gmail.send_email(receivers=users, subject="Movie Received. Downloading.",
message="Added movie name: " + added_torrent[0] +
"\nServer output: " + str(added_torrent[1]))
print("Sent response email\n" + " "*(print_length-(len("Sent response email"))))
parse_movies.cleanup(downloaded_movies_location)
new_downloaded = os.listdir(downloaded_movies_location)
successful_torrents = list(set(new_downloaded) - set(old_downloaded))
for torrent in successful_torrents:
parse_movies.parse(new_movies_location + "/" + torrent, plex, filebot_location)
print(" " * print_length)
print(torrent + " has been downloaded")
print(" " * print_length)