Send QQ mail via python

Source: Internet
Author: User
Tags account security mail account

Send QQ mail via python

# Encoding = UTF-8 _ author _ = 'ds' # File Name Conflict from email. mime. text import MIMETextimport smtplibif _ name _ = '_ main _': msg = MIMEText (_ text = 'smtp test', _ charset = 'utf-8 ') # enter the Email address and password from_addr = 'xxx @ qq.com 'password = 'xxx' # enter the SMTP server address: smtp_server = 'smtp .qq.com' # enter the recipient address: to_addr = 'xxx @ sina.cn '# The default SMTP port is 25 server = smtplib. SMTP (smtp_server, 25) server. set_debuglevel (1) # server. starttls () # server. connect (host = smtp_server, port = 25) # server. esmtp_features ["auth"] = "AUTH_LOGIN" server. login (from_addr, password) server. sendmail (from_addr, [to_addr], msg. as_string () server. quit ()
 
After the test, the error 454 is reported. It turns out that the SMTP service of the email is disabled in the QQ mailbox, and external access is unavailable.
Open the QQ mail account-> account security, and open the SMTP service and POP3 service.


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.