#34504: SSLCertVerificationError on outgoing emails for some mailboxes
-------------------------------------+-------------------------------------
     Reporter:  Kamen Kalchev        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Mail)          |                  Version:  4.2
     Severity:  Normal               |               Resolution:
     Keywords:  smtplib, ssl,        |             Triage Stage:
  Django4.2                          |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Kamen Kalchev:

Old description:

> It looks like this was previously reported in a different scenario and
> marked as fixed but is still not working as expected. Downgrading Django
> to 4.1.7 fixes the problem with outgoing messages to the mailbox.
>
> Environment:
>
> {{{
> Python3.10.6
> Django4.2
> }}}
>

>
> Link to previously reported issue:
> https://code.djangoproject.com/ticket/34386
>
> Stacktrace:
>
> {{{
> File "/usr/local/lib/env3/lib/python3.10/site-
> packages/django/core/mail/message.py" line 298 in send [args] [locals]
> return self.get_connection(fail_silently).send_messages([self])
> File "/usr/local/lib/env3/lib/python3.10/site-
> packages/django/core/mail/backends/smtp.py" line 127 in send_messages
> [args] [locals]
> new_conn_created = self.open()
> File "/usr/local/lib/env3/lib/python3.10/site-
> packages/django/core/mail/backends/smtp.py" line 85 in open [args]
> [locals]
> self.connection = self.connection_class(
> File "/usr/lib/python3.10/smtplib.py" line 1050 in __init__ [args]
> [locals]
> SMTP.__init__(self, host, port, local_hostname, timeout,
> File "/usr/lib/python3.10/smtplib.py" line 255 in __init__ [args]
> [locals]
> (code, msg) = self.connect(host, port)
> File "/usr/lib/python3.10/smtplib.py" line 341 in connect [args] [locals]
> self.sock = self._get_socket(host, port, self.timeout)
> File "/usr/lib/python3.10/smtplib.py" line 1057 in _get_socket [args]
> [locals]
> new_socket = self.context.wrap_socket(new_socket,
> File "/usr/lib/python3.10/ssl.py" line 513 in wrap_socket [args] [locals]
> return self.sslsocket_class._create(
> File "/usr/lib/python3.10/ssl.py" line 1071 in _create [args] [locals]
> self.do_handshake()
> File "/usr/lib/python3.10/ssl.py" line 1342 in do_handshake [args]
> [locals]
> self._sslobj.do_handshake()
> SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate
> verify failed: unable to get local issuer certificate (_ssl.c:997)
> }}}

New description:

 It looks like this was previously reported in a different scenario and
 marked as fixed but is still not working as expected. Downgrading Django
 to 4.1.7 fixes the problem with outgoing messages to the mailbox.

 Environment:

 {{{
 Python3.10.6
 Django4.2
 EMAIL_USE_SSL=True
 EMAIL_USE_TLS=False

 EMAIL_SSL_CERTFILE=Does not make a difference if we provide a file
 location or not
 EMAIL_SSL_KEYFILE=Does not make a difference if we provide a file location
 or not
 }}}



 Link to previously reported issue:
 https://code.djangoproject.com/ticket/34386

 Stacktrace:

 {{{
 File "/usr/local/lib/env3/lib/python3.10/site-
 packages/django/core/mail/message.py" line 298 in send [args] [locals]
 return self.get_connection(fail_silently).send_messages([self])
 File "/usr/local/lib/env3/lib/python3.10/site-
 packages/django/core/mail/backends/smtp.py" line 127 in send_messages
 [args] [locals]
 new_conn_created = self.open()
 File "/usr/local/lib/env3/lib/python3.10/site-
 packages/django/core/mail/backends/smtp.py" line 85 in open [args]
 [locals]
 self.connection = self.connection_class(
 File "/usr/lib/python3.10/smtplib.py" line 1050 in __init__ [args]
 [locals]
 SMTP.__init__(self, host, port, local_hostname, timeout,
 File "/usr/lib/python3.10/smtplib.py" line 255 in __init__ [args] [locals]
 (code, msg) = self.connect(host, port)
 File "/usr/lib/python3.10/smtplib.py" line 341 in connect [args] [locals]
 self.sock = self._get_socket(host, port, self.timeout)
 File "/usr/lib/python3.10/smtplib.py" line 1057 in _get_socket [args]
 [locals]
 new_socket = self.context.wrap_socket(new_socket,
 File "/usr/lib/python3.10/ssl.py" line 513 in wrap_socket [args] [locals]
 return self.sslsocket_class._create(
 File "/usr/lib/python3.10/ssl.py" line 1071 in _create [args] [locals]
 self.do_handshake()
 File "/usr/lib/python3.10/ssl.py" line 1342 in do_handshake [args]
 [locals]
 self._sslobj.do_handshake()
 SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate
 verify failed: unable to get local issuer certificate (_ssl.c:997)
 }}}

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34504#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018798d11d93-d37f94be-3919-4267-b9b8-f20ea6ac6ad9-000000%40eu-central-1.amazonses.com.

Reply via email to