• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

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.

Inheritance
object
SmtpResponse
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: DRIT.Mail.Rfc.Smtp
Assembly: DRIT.Mail.dll
Syntax
public sealed class SmtpResponse

Constructors

View Source

SmtpResponse(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. 2.1.0) if present, or null.

Properties

View Source

Code

Gets the three-digit reply code (e.g. 220, 250, 535).

Declaration
public int Code { get; }
Property Value
Type Description
int
View Source

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
View Source

IsNegative

Gets a value indicating whether the reply is negative (4xx or 5xx).

Declaration
public bool IsNegative { get; }
Property Value
Type Description
bool
View Source

IsPermanentNegative

Gets a value indicating whether the reply is a permanent negative completion (5xx).

Declaration
public bool IsPermanentNegative { get; }
Property Value
Type Description
bool
View Source

IsPositive

Gets a value indicating whether the reply is positive (2xx).

Declaration
public bool IsPositive { get; }
Property Value
Type Description
bool
View Source

IsTransientNegative

Gets a value indicating whether the reply is a transient negative completion (4xx).

Declaration
public bool IsTransientNegative { get; }
Property Value
Type Description
bool
View Source

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>
View Source

Text

Gets the joined text of all reply lines, space-separated.

Declaration
public string Text { get; }
Property Value
Type Description
string

Methods

View Source

IsCode(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 code.

View Source

ToString()

Returns the string representation of this reply.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()
  • View Source
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX