diff --git a/dbmail/backends/mail.py b/dbmail/backends/mail.py index 8f9ed82..afab24e 100644 --- a/dbmail/backends/mail.py +++ b/dbmail/backends/mail.py @@ -70,7 +70,7 @@ def _insert_mailer_identification_head(self): def _get_connection(self): if self._template.auth_credentials: return self._kwargs.pop('connection', None) or get_connection( - **self._template.auth_credentials) + **self._template.from_email.get_auth()) return self._kwargs.pop('connection', None) def _get_template(self): diff --git a/dbmail/models.py b/dbmail/models.py index 00a225a..69ade02 100644 --- a/dbmail/models.py +++ b/dbmail/models.py @@ -98,8 +98,8 @@ def get_auth(self): return dict( host=self.credential.host, port=self.credential.port, - username=self.credential.username, - password=self.credential.password, + username=str(self.credential.username), + password=str(self.credential.password), use_tls=self.credential.use_tls, fail_silently=self.credential.fail_silently )