Python Write bulk mail (QQ mailbox)

Source: Internet
Author: User

#e-mail operationsImportPoplibImportSmtplib fromEmail.headerImportDecode_header fromEmail.mime.textImportMimetextImportEmail#how to log in to mail#To log in as a destination for sending mail or to read a message#Send mail login generally login using SMTP, receive mailbox with pop_user ="[email protected]"_pwd="xxxxxxxx"  #QQ Mailbox for authorization code (16-bit)Sent =smtplib. Smtp_ssl ('smtp.qq.com', 465)#The SMTP server is set to stmp.qq.com with its port number 465Sent.login (_user, _pwd)#Login#Send mail#now that you have logged in, you need to set the sending content and send itTry: to=['[email protected]','[email protected]','[email protected]','[email protected]','[email protected]'] Content=mimetext ('mass testing, do not return, if disturbed, in this apology, thank you')#Mimetext indicates the message sent to the specific contentcontent['Subject']='python email Bulk test! Hello'#set the mailbox headercontent[' from']="'#set where mailboxes are sentcontent[' to']=','. Join (TO)#here set the address to send the message, you can massSent.sendmail ('[email protected]', To,content.as_string ())#three parametersSent.close ()#Close MailboxexceptSmtplib. SMTPEXCEPTION.E:Print("falied,%s"%e)

Note: If you report the wrong, please check the Mailbox Settings SMTP service is turned on, whether to obtain the authorization code, please see the following bold page address

Smtplib. Smtpauthenticationerror: (535, B ' Error: \xc7\xeb\xca\xb9\xd3\xc3\xca\xda\xc8\xa8\xc2\xeb\xb5\xc7\xc2\xbc\xa1\xa3\ Xcf\xea\xc7\xe9\xc7\xeb\xbf\xb4: http://service.mail.qq.com/cgi-bin/help?subtype=1&&id =28&&no=1001256 ')

Python Write bulk mail (QQ mailbox)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.