| 1028 | default_port = SMTP_SSL_PORT |
| 1029 | |
| 1030 | def __init__(self, host='', port=0, local_hostname=None, |
| 1031 | keyfile=None, certfile=None, |
| 1032 | timeout=socket._GLOBAL_DEFAULT_TIMEOUT, |
| 1033 | source_address=None, context=None): |
| 1034 | if context is not None and keyfile is not None: |
| 1035 | raise ValueError("context and keyfile arguments are mutually " |
| 1036 | "exclusive") |
| 1037 | if context is not None and certfile is not None: |
| 1038 | raise ValueError("context and certfile arguments are mutually " |
| 1039 | "exclusive") |
| 1040 | if keyfile is not None or certfile is not None: |
| 1041 | import warnings |
| 1042 | warnings.warn("keyfile and certfile are deprecated, use a " |
| 1043 | "custom context instead", DeprecationWarning, 2) |
| 1044 | self.keyfile = keyfile |
| 1045 | self.certfile = certfile |
| 1046 | if context is None: |
| 1047 | context = ssl._create_stdlib_context(certfile=certfile, |
| 1048 | keyfile=keyfile) |
| 1049 | self.context = context |
| 1050 | SMTP.__init__(self, host, port, local_hostname, timeout, |
| 1051 | source_address) |
| 1052 | |
| 1053 | def _get_socket(self, host, port, timeout): |
| 1054 | if self.debuglevel > 0: |