Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use Python to simulate login and send QQ mail to QQ Mail

Shulou Source: shulou.com Published: 2022-06-02 04:19:14 10月05日 Update

This article mainly introduces "how to use Python to achieve simulated login QQ mailbox to send QQ mail", in daily operation, I believe many people in how to use Python to achieve simulated login QQ mailbox to send QQ mail problems have doubts, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "how to use Python to achieve simulated login QQ mailbox to send QQ mail" doubts help! Next, please follow the small series to learn together!

Attach the code first

from email.mime.text import MIMETextfrom email.header import Headerfrom smtplib import SMTP_SSL#qq mailbox smtp server host_server = 'smtp.qq.com'#sender_qq is the qq number of sender_qq = '3723358***'#pwd is the authorization code of qq mailbox pwd = '**iao**lxpic**'#sender's mailbox sender_qq_mail = '3723358**@qq.com'#mailbox <$receiver = 'thunder <$$><$@ gmail.com'#recipient's mail_content = 'hello, I'm from Zhihu [Deng Xudong], HIT Now we are doing a test of logging in qq mailbox with python to send mail '#mail title = ' Deng Xudong HIT mail '#ssl login smtp = SMTP_SSL(host_server)#set_debuglevel() is used for debugging. parameter value of 1 means to enable debugging mode, parameter value of 0 means to disable debugging mode smtp.set_debuglevel(1)smtp.ehlo(host_server)smtp.login(sender_qq, pwd)msg = MIMEText(mail_content, "plain", 'utf-8') msg["Subject"] = Header(mail_title, ' utf-8') msg["From"] = sender_qq_mailmsg["To"] = receiversmtp.sendmail(sender_qq_mail, receiver, msg.as_string())smtp.quit() Here, about "how to use Python to achieve simulated login QQ mailbox to send QQ mail" learning is over, I hope to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Tags: Mailbox email login learning parameters sender more pattern Xudong help utility next code hello content number recipient article method server Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi Shulou Technology Docker Huawei