zoukankan      html  css  js  c++  java
  • python:发邮件

    import yagmail
    username='test@163.com'
    password='test123'   #免费邮箱,这里用授权码,一般自己公司的直接写邮箱密码即可
    smtp='smtp.163.com'    #注意这里是smtp.163.com,不是smtp@163.com。不要写错
    mail=yagmail.SMTP(user=username,password=password,host=smtp)   #链接邮箱
    to =['hehe#163.com','454797@qq.com']     #多个收件人传list
    cc='14464564646@qq.com'
    subject='test'
    content='内容'
    files=[r'E:BestTest上课内容处女座学员名单.xlsx','E:BestTest上课内容QQ图片20190603150645.jpg']   #多个附件用list
    mail.send(to=to,cc=cc,subject=subject,contents=content,attachements=files)
    # to:收件人,cc:抄送人,subject:标题,contents:内容;attachments:附件
    #原pip安装的yagmail,发邮件带中文附件会有乱码,使用牛牛的.whl文件。E:BestTest上课内容课程yagmail-0.10.212-py2.py3-none-any.whl
  • 相关阅读:
    Unique path
    *Jump Game
    Valid Palindrome
    *Reverse Words in a String
    Min Stack
    [?]*Simplify Path
    *Valid Parentheses
    *Sqrt(x)
    String to Integer (atoi)
    Add Digits
  • 原文地址:https://www.cnblogs.com/hancece/p/11089348.html
Copyright © 2011-2022 走看看