import smtplib from email.mime.text import MIMEText from email.utils import formataddr def email(email_list, content, subject="抽屉新热榜-用户注册"): msg = MIMEText(content, 'plain', 'utf-8') msg['From'] = formataddr(["抽屉新热榜",'[email protected]']) msg['Subject'] = subject # SMTP服务- server = smtplib.SMTP("smtp.126.com", 25) #url 端口 server.login("[email protected]", "JUEmimima") server.sendmail('[email protected]', email_list, msg.as_string()) server.quit() # email(['[email protected]','[email protected]'], 'xiaohuzuishuai')
发送短信微信:从服务商处购买url,用如http://www.fasong.com?...&...&...
也可用requests模块 import requests