python send QQ mail based on SMTP, for your reference, the details are as follows
Step one:
1. open qq mailbox, open smtp service
2.Verify password
3. Get the authorization code
The python code uses the
In Python, the smtplib module provides a rich mail sending interface, just set the smtp server and port, enter the account password login, you can use the mail sending interface.
import smtplib from import MIMEText from import Header sender='send@' # Mail delivery account reciever='accept@' #Receive Mail Accounts password='ghlvlojhekpcbffj' # Authorization code (this should be filled in with the one you got) smtp_server=''# Fixed write dead smtp_port=465# Fixed ports # Configure the server stmp=smtplib.SMTP_SSL(smtp_server,smtp_port) (sender,password) message = MIMEText('I am sending content', 'plain', 'utf-8') # of content sent message['From'] = sender message['To'] = reciever subject = 'Python SMTP mail test' message['Subject'] = Header(subject, 'utf-8') #Mail Headers try: (sender, reciever, message.as_string()) except Exception as e: print ('Mail delivery failed -' + str(e)) print ('Email sent successfully'
This is the whole content of this article.