The SMTP protocol can be encrypted at a low level with either TLS or
SSL. It depends on the SMTP server. Most hosts will offer one or both,
and they should tell you, as well as the corresponding port (typically
465 or 587 for secured connections). If you are configured with TLS or
no security when you should be using SSL, web2py requests will take a
few minutes and eventually the server will report a message send
failure.

Further reading:
http://en.wikipedia.org/wiki/SMTPS

-Eric

On Jul 23, 7:59 am, Jonathan Lundell <[email protected]> wrote:
> On Jul 23, 2011, at 12:30 AM, Eric Vicenti wrote:
>
> > 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.
>
> Under what circumstances would you use ssl vs tis?
>
>
>
>
>
>
>
>
>
> > 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

Reply via email to