当前位置: 首页>>代码示例>>Python>>正文


Python Connection.set_smtp方法代码示例

本文整理汇总了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.")
开发者ID:CodecoolBP20161,项目名称:python-school-system-with-orm-dog-five,代码行数:11,代码来源:orm_email.py

示例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")
开发者ID:CodecoolBP20161,项目名称:python-school-system-with-orm-dog-five,代码行数:31,代码来源:main.py


注:本文中的connection.Connection.set_smtp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。