Ticket #3560: secure-mail.patch

File secure-mail.patch, 773 bytes (added by boxed@…, 9 years ago)

patch for secure SMTP sending. Note that I have added a new setting.

  • django/core/mail.py

     
    5050    """
    5151    try:
    5252        server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
     53        try:
     54            if settings.EMAIL_SECURE_SMTP:
     55                server.ehlo()
     56                server.starttls()
     57                server.ehlo()
     58        except AttributeError:
     59            pass
    5360        if auth_user and auth_password:
    5461            server.login(auth_user, auth_password)
    5562    except:
     
    7986                raise
    8087    try:
    8188        server.quit()
     89    except socket.sslerror:
     90        pass
    8291    except:
    8392        if fail_silently:
    8493            return
Back to Top