[docs]classSMTPException(Exception):""" Base class for all SMTP exceptions. """def__init__(self,message:str,/)->None:self.message=messageself.args=(message,)
[docs]classSMTPServerDisconnected(SMTPException,ConnectionError):""" The connection was lost unexpectedly, or a command was run that requires a connection. """
[docs]classSMTPConnectError(SMTPException,ConnectionError):""" An error occurred while connecting to the SMTP server. """
[docs]classSMTPTimeoutError(SMTPException,TimeoutError):""" A timeout occurred while performing a network operation. """
[docs]classSMTPConnectTimeoutError(SMTPTimeoutError,SMTPConnectError):""" A timeout occurred while connecting to the SMTP server. """
[docs]classSMTPReadTimeoutError(SMTPTimeoutError):""" A timeout occurred while waiting for a response from the SMTP server. """
[docs]classSMTPNotSupported(SMTPException):""" A command or argument sent to the SMTP server is not supported. """
[docs]classSMTPResponseException(SMTPException):""" Base class for all server responses with error codes. """def__init__(self,code:int,message:str,/)->None:self.code=codeself.message=messageself.args=(code,message)
[docs]classSMTPConnectResponseError(SMTPResponseException,SMTPConnectError):""" The SMTP server returned an invalid response code after connecting. """
[docs]classSMTPHeloError(SMTPResponseException):""" Server refused HELO or EHLO. """
[docs]classSMTPDataError(SMTPResponseException):""" Server refused DATA content. """
[docs]classSMTPAuthenticationError(SMTPResponseException):""" Server refused our AUTH request; may be caused by invalid credentials. """
[docs]classSMTPSenderRefused(SMTPResponseException):""" SMTP server refused the message sender. """def__init__(self,code:int,message:str,sender:str,/)->None:self.code=codeself.message=messageself.sender=senderself.args=(code,message,sender)
[docs]classSMTPRecipientRefused(SMTPResponseException):""" SMTP server refused a message recipient. """def__init__(self,code:int,message:str,recipient:str,/)->None:self.code=codeself.message=messageself.recipient=recipientself.args=(code,message,recipient)
[docs]classSMTPRecipientsRefused(SMTPException):""" SMTP server refused multiple recipients. """def__init__(self,recipients:list[SMTPRecipientRefused],/)->None:self.recipients=recipientsself.args=(recipients,)