Adjusts to use a different loading of certificates and updates the docs for it

This commit is contained in:
Trenton H 2023-08-23 07:28:36 -07:00
parent 16adddc803
commit df82ac8ac4
2 changed files with 4 additions and 4 deletions

View File

@ -503,9 +503,9 @@ HTTP header/value expected by Django, eg `'["HTTP_X_FORWARDED_PROTO", "https"]'`
`PAPERLESS_EMAIL_CERTIFICATE_FILE=<path>`
: Configures an additional SSL certificate file containing a [combined key and certificate](https://docs.python.org/3/library/ssl.html#combined-key-and-certificate) file
for validating SSL connections against mail providers. This is for use with self-signed certificates against
local IMAP servers.
: Configures an additional SSL certificate file containing a [certificate](https://docs.python.org/3/library/ssl.html#certificates)
or certificate chain which should be trusted for validating SSL connections against mail providers.
This is for use with self-signed certificates against local IMAP servers.
Defaults to None.

View File

@ -397,7 +397,7 @@ def get_mailbox(server, port, security) -> MailBox:
"""
ssl_context = ssl.create_default_context()
if settings.EMAIL_CERTIFICATE_FILE is not None: # pragma: nocover
ssl_context.load_cert_chain(certfile=settings.EMAIL_CERTIFICATE_FILE)
ssl_context.load_verify_locations(cafile=settings.EMAIL_CERTIFICATE_FILE)
if security == MailAccount.ImapSecurity.NONE:
mailbox = MailBoxUnencrypted(server, port)