Exemplo n.º 1
0
        /// <summary>
        /// Reply to the client.
        /// </summary>
        /// <param name="client">The text stream to perform the operation on.</param>
        /// <param name="response">The response.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>A task which performs the operation.</returns>
        public static async Task ReplyAsync(this INetworkClient client, SmtpResponse response, CancellationToken cancellationToken)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            await client.WriteLineAsync($"{(int)response.ReplyCode} {response.Message}", cancellationToken).ConfigureAwait(false);

            await client.FlushAsync(cancellationToken).ConfigureAwait(false);
        }