PCQRSCANER/venv/Lib/site-packages/imapclient/examples/tls_no_checks.py

24 lines
659 B
Python
Raw Normal View History

2019-12-22 21:51:47 +01:00
# Copyright (c) 2015, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
from __future__ import unicode_literals
import imapclient
from backports import ssl
HOST = 'imap.host.com'
USERNAME = 'someuser'
PASSWORD = 'secret'
context = imapclient.create_default_context()
# don't check if certificate hostname doesn't match target hostname
context.check_hostname = False
# don't check if the certificate is trusted by a certificate authority
context.verify_mode = ssl.CERT_NONE
server = imapclient.IMAPClient(HOST, use_uid=True, ssl=True, ssl_context=context)
server.login(USERNAME, PASSWORD)
# ...