![]() ![]() Returns aĢ-tuple of the response code and message sent by the server in its The constructor if a host is specified during instantiation. If the hostname ends with a colon ( ':')įollowed by a number, that suffix will be stripped off and the number connect ( host = 'localhost', port = 0 ) ¶Ĭonnect to a host on a given port. If the connection to the server is lost while waiting for the reply, It is used to implement other methods and may be useful for testing private ![]() In normal operation it should not be necessary to call this method explicitly. Response line (multiline responses are joined into one long line.) This returns a 2-tuple composed of a numeric response code and the actual The optional argument args is simplyĬoncatenated to the command, separated by a space. The command or option attempted is not supported by the server.Ĭhanged in version 3.5: Added debuglevel 2. SMTPConnectError ¶Įrror occurred during establishment of a connection with the server. The SMTP server refused to accept the message data. Through the attribute recipients, which is a dictionary of exactly the The errors for each recipient are accessible SMTPRecipientsRefused ¶Īll recipient addresses refused. SMTPResponseException exceptions, this sets ‘sender’ to the string that In addition to the attributes set by on all Smtp_error attribute is set to the error message. TheĮrror code is stored in the smtp_code attribute of the error, and the These exceptionsĪre generated in some instances when the SMTP server returns an error code. SMTPResponseException ¶īase class for all exceptions that include an SMTP error code. This exception is raised when the server unexpectedly disconnects, or when anĪttempt is made to use the SMTP instance before connecting it to a Point to a PEM formatted private key and certificate chain file for theĬhanged in version 3.4: SMTPException became subclass of OSError exception smtplib. Keyfile and certfile are a legacy alternative to context, and can context, also optional,Ĭan contain a SSLContext and allows configuring variousĪspects of the secure connection. The optionalĪrguments local_hostname, timeout and source_address have the same Port is zero, the standard SMTP-over-SSL port (465) is used. If host is not specified, the local host is used. Required from the beginning of the connection and using starttls() is SMTP_SSL should be used for situations where SSL is SMTP_SSL ( host='', port=0, local_hostname=None, keyfile=None, certfile=None, context=None, source_address=None ) ¶Īn SMTP_SSL instance behaves exactly the same as instances of ValueError to prevent the creation of a non-blocking socket class smtplib. Like this, the SMTP QUIT command is issued automatically when theĬhanged in version 3.9: If the timeout parameter is set to be zero, it will raise a The SMTP class supports the with statement. Respectively) the OS default behavior will be used.įor normal use, you should only require the initialization/connect, If omitted (or if host or port are '' and/or 0 (host, port), for the socket to bind to as its source address beforeĬonnecting. Interfaces, and/or to some specific source TCP port. To some specific source address in a machine with multiple network The optional source_address parameter allows binding Like the connection attempt (if not specified, the global default timeout Timeout parameter specifies a timeout in seconds for blocking operations Than a success code, an SMTPConnectError is raised. If the connect() call returns anything other Otherwise, the local hostname is found using Local_hostname is used as the FQDN of the local host in the HELO/EHLOĬommand. Host and port parameters are given, the SMTP connect() method isĬalled with those parameters during initialization. That support a full repertoire of SMTP and ESMTP operations. SMTP ( host='', port=0, local_hostname=None, source_address=None ) ¶Īn SMTP instance encapsulates an SMTP connection. WebAssembly platforms for more information. This module does not work or is not available on WebAssembly platforms ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |