利用python发送邮件

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import smtplib
from email.mime.text import MIMEText


def mail_send():
    msg = MIMEText(
        "邮件内容填写此处",
        'html',
        'utf-8'
    )

    send_mail = "发送邮件地址"
    send_password = "邮箱密码和邮箱的授权码使用授权码会安全" 
accept_mail = "接受邮件地址" smtp = "smtp.126.com" msg['Form'] = send_mail msg["To"] = accept_mail msg['Subject'] = "邮件标题名称" server = smtplib.SMTP_SSL(smtp) server.login(send_mail, send_password) server.sendmail(send_mail, accept_mail, msg.as_string())

 

posted @ 2021-12-08 10:45  点点滴滴的努力  阅读(86)  评论(0)    收藏  举报