本文整理汇总了Python中connection.Connection.set_smtp方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.set_smtp方法的具体用法?Python Connection.set_smtp怎么用?Python Connection.set_smtp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connection.Connection
的用法示例。
在下文中一共展示了Connection.set_smtp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import set_smtp [as 别名]
def send(cls, msg_list):
server, fromaddr, password = Connection.set_smtp()
server.starttls()
server.login(fromaddr, password)
print("Sending e-mails, please wait.")
for msg in msg_list:
server.send_message(msg)
server.quit()
print("DONE.")
示例2: input
# 需要导入模块: from connection import Connection [as 别名]
# 或者: from connection.Connection import set_smtp [as 别名]
# Get user input to reach functions
user_input = input("Hello! Would you like to:\
\n1. Set up your database (WARNING: this will delete all your data!)\
\n2. Set up e-mail stuff\
\n3. Update new applicants with code and closest school\
\n4. Schedule interviews\
\n5. Send e-mails to new applicants\
\n")
if user_input == "1":
Build.create_tables()
Build.upload_data()
elif user_input == "2":
Connection.set_smtp()
elif user_input == "3":
Applicant.get_closest_school()
Applicant.update_appl_code()
elif user_input == "4":
InterviewSlot.schedule()
elif user_input == "5":
msg_list = OrmEmail.create_newappl_msg()
OrmEmail.send(msg_list)
else:
print("Bye")