美文网首页
Python3如何群发邮件

Python3如何群发邮件

作者: 一名优秀的电工 | 来源:发表于2017-11-30 15:18 被阅读0次
    import smtplib
    from email.mime.text import MIMEText
    from email.utils import formataddr
    
    def how_to_send():
        account='username@qq.com'# 发件人
        account_password = 'password'#邮箱密码
        recevier=['username@qq.com']#如果有多个收件人,就在列表中添加一项
        msg=MIMEText('内容','plain','utf-8')
        msg['Subject']="这里是标题" 
        send_email=smtplib.SMTP_SSL("smtp.qq.com", 465)
        send_email.login(account, account_password)
        send_email.sendmail(account,recevier,msg.as_string())
        send_email.quit()  # 关闭连接
    if __name__ == '__main__':
        how_to_send()
    

    相关文章

      网友评论

          本文标题:Python3如何群发邮件

          本文链接:https://www.haomeiwen.com/subject/ljvvbxtx.html