wijmo more beautiful Jquery UI component set: Reserve selection when sorting or filtering Wijmo GridView

2023-01-01   ES  

Welcome to visit a message

About the message board -code to the city attackMost articles do not support comments.https://www.codecomeon.com/posts/1/

python email, the full text mail server is on the premise of smtp.qq.com:

The following error:

raise SMTPServerDisconnected("Connection unexpectedly closed")

smtplib.SMTPServerDisconnected: Connection unexpectedly closed

pit: from django.core.mail import send_mail in django, send emails, the port number needs to be 25

Method 1: Use the relevant module. Take QQ as an example. The port number here is: 465


 Import SMTPLIB 
 From email.mime.text import mimetext 
 From email.header import header 

 _User = "[email protected]" 
 _pwd = "Independent password non -QQ password" 
 _to = "[email protected]" 

 msg = mimetext ("www.baidu.com") 
 msg ["subject"] = "Python Send Email Test" 
 msg ["from"] = _User 
 msg ["to"] = _to 

 i = 0 
 While I <1: 
         s = smtplib.smtp_ssl ("smtp.qq.com", 465) 
         s.login (_user, _pwd) 
         s.sendmail (_user, _to, msg.as_string ()) 
         s.quit () 
         Print ("Success!") 
     Except smtplib.smtpexception as e: 
         Print ("FALIED, %S" %E) 

     I = i + 1

Method two: Django framework send emails, configuration in settings.py is as follows:

email_backend = 'django.core.mail.Backends.smtp.emailBackend' 

 # SMPT service address 
 Email_host = 'smtp.qq.com' 

 #The port number 
 Email_port = 25 

 #Send the mailbox of the mail 
 Email_host_user = '[email protected]' 

 #The client authorization password set in the mailbox 
 Email_host_password = 'Client authorized password' 

 #The sender seen by the recipient 
 Email_from = 'python <[email protected]>'

views.py This is used like this:

from django.Core.mail Import Send_mail 

 send_mail ('Test successful', 'This is the text of the email', settings.email_from, ['[email protected]']))

is very simple. The key is not writing code. In some pit, the first method is 465, and the way to follow the framework is 25. As for why you check it next, you waste time here. Port 465 has always failed, try 25, below is a pit that a classmate has also stepped on:

Django Send the specific steps of QQ mailbox, and the pit you encountered_Junxieshiguan’s blog


Related Posts

linux shared library: ldlibrarypath and ld.so.conf have loved the Sina blog.

[javascript] 2. JS compatibility writing of IE/FF

Multi-thread programming-1 1/condition variable/level use example

RS232 serial port line connection method and line core drawing definition

wijmo more beautiful Jquery UI component set: Reserve selection when sorting or filtering Wijmo GridView

Random Posts

Python -Get the source data of the webpage and format it into ExclesNail

javascript’s thousands of points and remove thousands of points

POJ3006, Dirichlet’s theorem on Arithmetic Progressions, Di Likrey theorem.

git: Modify the last Commit

LOG4NET Introduction (transfer)