Class SmtpResponse
A single SMTP reply (RFC 5321 §4.2). Immutable. Multi-line replies (e.g. an EHLO response) are assembled into a single SmtpResponse whose Lines collection holds the individual text lines.
Inherited Members
Namespace: DRIT.Mail.Rfc.Smtp
Assembly: DRIT.Mail.dll
Syntax
public sealed class SmtpResponse
Constructors
View SourceSmtpResponse(int, string, IReadOnlyList<string>, string?)
Initializes a new instance of the SmtpResponse class.
Declaration
public SmtpResponse(int code, string text, IReadOnlyList<string> lines, string? enhancedStatusCode)
Parameters
| Type | Name | Description |
|---|---|---|
| int | code | Specifies the code value. |
| string | text | The joined text of all reply lines, space-separated. |
| IReadOnlyList<string> | lines | The individual reply text lines (without the code or separator). |
| string | enhancedStatusCode | The enhanced status code (RFC 3463, e.g. |
Properties
View SourceCode
Gets the three-digit reply code (e.g. 220, 250, 535).
Declaration
public int Code { get; }
Property Value
| Type | Description |
|---|---|
| int |
EnhancedStatusCode
Gets the enhanced status code (RFC 3463, e.g. 2.1.0) if
the server included one, or null.
Declaration
public string? EnhancedStatusCode { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsNegative
Gets a value indicating whether the reply is negative (4xx or 5xx).
Declaration
public bool IsNegative { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPermanentNegative
Gets a value indicating whether the reply is a permanent negative completion (5xx).
Declaration
public bool IsPermanentNegative { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPositive
Gets a value indicating whether the reply is positive (2xx).
Declaration
public bool IsPositive { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsTransientNegative
Gets a value indicating whether the reply is a transient negative completion (4xx).
Declaration
public bool IsTransientNegative { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Lines
Gets the individual reply text lines (without the code or separator character). For a single-line reply, this has one entry. For a multi-line EHLO response, each extension is one entry.
Declaration
public IReadOnlyList<string> Lines { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<string> |
Text
Gets the joined text of all reply lines, space-separated.
Declaration
public string Text { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceIsCode(int)
Determines whether the reply code matches the specified value.
Declaration
public bool IsCode(int code)
Parameters
| Type | Name | Description |
|---|---|---|
| int | code | The expected reply code. |
Returns
| Type | Description |
|---|---|
| bool | True if Code equals |
ToString()
Returns the string representation of this reply.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |