Close the connection to the email server.
(self)
| 144 | raise |
| 145 | |
| 146 | def close(self): |
| 147 | """Close the connection to the email server.""" |
| 148 | if self.connection is None: |
| 149 | return |
| 150 | try: |
| 151 | try: |
| 152 | self.connection.quit() |
| 153 | except (ssl.SSLError, smtplib.SMTPServerDisconnected): |
| 154 | # This happens when calling quit() on a TLS connection |
| 155 | # sometimes, or when the connection was already disconnected |
| 156 | # by the server. |
| 157 | self.connection.close() |
| 158 | except smtplib.SMTPException: |
| 159 | if self.fail_silently: |
| 160 | return |
| 161 | raise |
| 162 | finally: |
| 163 | self.connection = None |
| 164 | |
| 165 | def send_messages(self, email_messages): |
| 166 | """ |
no outgoing calls
no test coverage detected