Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


fix for #19 #20

merged 1 commit into from

2 participants


here is a simple fix for the tls and ssl settings so that when people set it as False in the deploy.ini they are considered False for pyramid_mailer

@mmerickel mmerickel merged commit 145e71b into from

merged and modified to use pyramid.settings.asbool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +4 −0 pyramid_mailer/
  2. +2 −2 pyramid_mailer/
4 pyramid_mailer/
@@ -165,6 +165,10 @@ def from_settings(cls, settings, prefix='mail.'):
kwargs = dict(((k[size:], settings[k]) for k in settings.keys() if
k in kwarg_names))
+ for key in ('tls', 'ssl'):
+ if key in kwargs and str(kwargs[key]).strip().lower() in (0, 'false'):
+ kwargs[key] = False
return cls(**kwargs)
def send(self, message):
4 pyramid_mailer/
@@ -580,7 +580,7 @@ def test_from_settings(self):
'mymail.port' : 123,
'mymail.username' : 'tester',
'mymail.password' : 'test',
- 'mymail.tls' : True,
+ 'mymail.tls' : 'false',
'mymail.ssl' : True,
'mymail.keyfile' : 'ssl.key',
'mymail.certfile' : 'ssl.crt',
@@ -593,7 +593,7 @@ def test_from_settings(self):
self.assertEqual(mailer.direct_delivery.mailer.port, 123)
self.assertEqual(mailer.direct_delivery.mailer.username, 'tester')
self.assertEqual(mailer.direct_delivery.mailer.password, 'test')
- self.assertEqual(mailer.direct_delivery.mailer.force_tls, True)
+ self.assertEqual(mailer.direct_delivery.mailer.force_tls, False)
if ssl_enabled:
self.assertEqual(mailer.direct_delivery.mailer.smtp, SMTP_SSL)
else: # pragma: no cover
Something went wrong with that request. Please try again.