← Interactive API Explorer
Namespace: System.Net.Mail

SmtpException

Represents the exception that is thrown when the SmtpClient is not able to complete a Send or SendAsync operation.

Properties (1)

SmtpStatusCode StatusCode
Gets the status code returned by an SMTP server when an email message is transmitted.
Value: An SmtpStatusCode value that indicates the error that occurred.

Methods (2)

SmtpException(String)Constructor
Initializes a new instance of the SmtpException class with the specified error message.
ParameterDescription
messageA String that describes the error that occurred.
SmtpException(Net.Mail.SmtpStatusCode,String)Constructor
Initializes a new instance of the SmtpException class with the specified status code and error message.
ParameterDescription
statusCodeAn SmtpStatusCode value.
messageA String that describes the error that occurred.