[Answered ]-Django email: was connection to SMTP server established?

1👍

connection = mail.get_connection()

After this line, connection represents an settings.EmailBackend object

Check this

And now your connection object has an attribute connection which represents connection is already open or not

check this and this

So In general terms, logic will be

if connection.connection :
   # already open
else:
   # not open

Also I will add one point,

When you do connection.open(), django itself checks whether the connection is already open or not, and do things accordingly.

See this from django’s repo

Leave a comment