Right, here's a repeat of my comment earlier: 

```python
    # If local_hostname is not specified, socket.getfqdn() gets used.
    # For performance, we use the cached FQDN for local_hostname.
    connection_class = smtplib.SMTP_SSL if self.use_ssl else smtplib.SMTP
    connection_params = {
        'local_hostname': DNS_NAME.get_fqdn(),
    }
    if self.timeout is not None:
        connection_params['timeout'] = self.timeout

    self.connection = connection_class(self.host, self.port, **connection_params)

    # TLS/SSL are mutually exclusive, so only attempt TLS over
    # non-secure connections.
    if not self.use_ssl and self.use_tls:
        self.connection.ehlo()
        self.connection.starttls()
        self.connection.ehlo()
```