今天第一天去新浪实习,吐槽下实验室,一直不让实习,太黑。最近比较闲,没啥面试,论文也差不多了,终于找到了人生第一份实习,也算是和北京告别的第一天。当年怀着无比向往的心情来到帝都,时间真快,一转眼就要离开了,从一开始不适应这里干燥的空气,鼻子出血,到现在已经习惯了这里的气侯,甚至雾霾,真要离开竟有一丝不舍,因为这里是北京,有着五彩斑阑的机会和无限的可能,有着无数年轻人的梦想。告别帝都从新浪实习开始吧。第一天,人工查看是否是垃圾邮件,编写python脚本自动发邮件进行测试,代码如下

import smtplib
from email.mime.text import MIMEText
mailto_list=["yxh.8116836@163.com","tinyfisher@foxmail.com"] 
mail_host="smtp.sina.cn"   
mail_user="tinyfisherbupt" 
mail_pass="*****"    
mail_postfix="sina.com"    
def send_mail(to_list,sub,content):    
    me=mail_user+"<"+mail_user+"@"+mail_postfix+">"
    msg = MIMEText(content)
    msg['Subject'] = sub
    msg['From'] = me
    msg['To'] = ";".join(to_list)
    try:
        s = smtplib.SMTP()
        s.connect(mail_host)
        s.login(mail_user,mail_pass) 
        s.sendmail(me, to_list, msg.as_string())
        s.close()
        return True
        except Exception, e:
        print str(e)
        return False
if __name__ == '__main__':
    if send_mail(mailto_list,"subject","content"):
        print "send success"
    else:
        print "send fail"

需要注意的是,你的邮箱需要开启smtp/pop3,登录到你的web邮箱,在里面的设置里开启



blog comments powered by Disqus