python's smtplib provides a convenient way to send e-mail. It has a simple encapsulation of the SMTP protocol.
below is an example of using smtplib to send mail to QQ mailbox.

must first open the SMTP service of the QQ mailbox and open it in the settings account of the QQ mailbox's personal home page. Figure:

after the successful opening of the license code, the password is the login password when the smtp send the message.

a simple example of sending mail:

 from smtplib import SMTP_SSL from email.mime.text import MIMEText. The SMTP server address of the QQ mailbox is login = "123456@qq.com", which sends the username of the mailbox password = "xddflpwqesfkbidf" to send the password of the mailbox, that is, the authorization code for the SMTP service is opened. Note: not the QQ password. Subject = "python+smtp" text = "send email" text content SMTP = SMTP_SSL (hostname) #SMTP_SSL default using smtp.login (login, password) = = =] =] =] =] =] =] =] = = = SMTP_SSL (login, password)) = = = = SMTP_SSL (login, password)] = = =] = = = SMTP_SSL = SMTP_SSL (password)] = = = = = SMTP_SSL (login, password)] = = =] = = = SMTP_SSL = hostname) = = SMTP_SSL (login, password) = = = = SMTP_SSL (login, password)] = = = = = = SMTP_SSL (password)] = = = = SMTP_SSL (login, password)] = = =] = = = SMTP_SSL = hostname) = SMTP_SSL (login, password). Smtp.sendmail (email_from, email_to, msg.as_string ()) smtp.quit () 

script execution result:

above is the whole content of this article, I hope it will help everyone's learning, and I hope you will support the script home.

This paper fixed link:http://www.script-home.com/python-uses-smtplib-to-send-mail-to-qq-mailboxes.html | Script Home | +Copy Link

Article reprint please specify:Python uses smtplib to send mail to QQ mailboxes | Script Home

You may also be interested in these articles!