def send_mail(sender,to,password,port,subject,body):
try:
message = "Subject: {}\n\n{}".format(subject,body)
mail = smtplib.SMTP('smtp.gmail.com',port)
mail.starttls()
mail.login(sender,password)
mail.sendmail(sender, to, message)
print "\nSent email successfully.\n"
except smtplib.SMTPAuthenticationError:
print "\nCould not athenticate with password and username!\n"
评论列表
文章目录