zoukankan      html  css  js  c++  java
  • python给邮箱发送消息

    首先要用到两个模块  并且大同你的发送邮箱smtp 最开始测试没打通了好久

    smtplib是提供邮箱smtp服务, email是提供你发送消息的格式之类服务

    import smtplib
    from email.mime.text import MIMEText
    
    def em(message, send_email):
        '''
        
        :param message:   发送的信息
        :param send_email:  接收人
        :return: 
        '''
        msg = MIMEText(message, 'plain', 'utf-8')
        from_addr = "jumpserver@mallcai.com"  # 发送人
        password = "1rgyUwb26ipoOk"   # 发送人密码
        smtp_server = "smtp.mxhichina.com"  # 邮箱的smtp服务器
        to_addr = send_email  # 接收人
        server = smtplib.SMTP(smtp_server, 25)
        server.set_debuglevel(1)
        server.login(from_addr, password)
        server.sendmail(from_addr, [to_addr], msg.as_string())
        server.quit()
  • 相关阅读:
    SpringMVC初识视图解析器
    初识SpringMVC
    C++ 虚函数表
    C++ 纯虚函数 + 抽象类
    C++ 虚析构函数
    C++ 虚函数
    C++ 多态
    leetcode
    leetcode
    leetcode 10.正则表达式匹配
  • 原文地址:https://www.cnblogs.com/zhaoyunlong/p/10508876.html
Copyright © 2011-2022 走看看