+1

in trunk ... now.

Massimo

On Jul 23, 2:30 am, Eric Vicenti <[email protected]> wrote:
> Hey, all
>
> I was having difficulties sending from web2py, when I realized there
> is no SSL encryption support. Since this is already built into
> smtplib, it was a simple addition. I should mention this wont work on
> GAE, and I have not comprehensively tested it.
>
> diff -r 800e086037d9 gluon/tools.py
> --- a/gluon/tools.py    Sat Jul 23 01:47:05 2011 -0500
> +++ b/gluon/tools.py    Sat Jul 23 00:17:49 2011 -0700
> @@ -206,6 +206,7 @@
>          settings.sender = sender
>          settings.login = login
>          settings.tls = tls
> +        settings.ssl = False
>          settings.cipher_type = None
>          settings.sign = True
>          settings.sign_passphrase = None
> @@ -569,8 +570,11 @@
>                      result =
> mail.send_mail(sender=self.settings.sender, to=origTo,
>                                              subject=subject,
> body=text, **xcc)
>              else:
> -                server =
> smtplib.SMTP(*self.settings.server.split(':'))
> -                if self.settings.tls:
> +                if self.settings.ssl:
> +                    server =
> smtplib.SMTP_SSL(*self.settings.server.split(':'))
> +                else:
> +                    server =
> smtplib.SMTP(*self.settings.server.split(':'))
> +                if self.settings.tls and not self.settings.ssl:
>                      server.ehlo()
>                      server.starttls()
>                      server.ehlo()
>
> To use, simply set mail.settings.ssl = True
>
> Enjoy!

Reply via email to