Python: Get Gmail server with smtplib never ends
问题 I simply tried: >>> import smtplib >>> server = smtplib.SMTP('smtp.gmail.com:587') in my Python interpreter but the second statement never ends. Can someone help? 回答1: You might find that you need a login and password as a prerequisite to a successful login-in. Try something like this: import smtplib ServerConnect = False try: smtp_server = smtplib.SMTP('smtp.gmail.com','587') smtp_server.login('your_login', 'password') ServerConnect = True except SMTPHeloError as e: print "Server did not