Why do I have to turn off TLS to send mail when using the smtp service of 163s?

1. Question
what is the principle of using flask-email in Flask through the smtp service of 163mailboxes, you need to turn off TLS to send mail?


def SendEmail(strinfo, title="", recipients="xxxxxxxxx@qq.com"):
    """
    :param strinfo: 
    :param recipients: ,
    :return:0

     
    """

    import smtplib  -sharp 
    from email.mime.text import MIMEText  -sharp 
    try:
        smtp_server = "smtp.yeah.net"  -sharp smtp
        smtp_port = 25  -sharp smtp
        smtp_user = "username@yeah.net"  -sharp smtp
        password = "password"  -sharp smtp
        msg = MIMEText(strinfo)-sharp
        msg["Subject"] = "%s" % title -sharp 
        msg["From"] = smtp_user  -sharp 
        msg["To"] = recipients  -sharp 
        email = smtplib.SMTP(smtp_server, int(smtp_port))  -sharp 
        email.login(user=smtp_user, password=password)  -sharp 
        email.sendmail(smtp_user, recipients.split(","), msg.as_string())
        -sharp recipients
        email.quit()  -sharp 
        return 0
    except Exception as e:
        pass
        -sharp writelog("%s" % e)

I use the smtplib library NetEase to send it to QQ Mail without deliberately setting anything

.

http://help.163.com/10/1111/1.

Menu