private Result Send(MailMessage message, MailAddress addr) { WriteLine("MAIL FROM: " + "<" + message.From.Address + ">"); Read(SmtpStatusCode.Ok); WriteLine("RCPT TO: " + "<" + addr.Address + ">"); SmtpResponse response = Read(); if (response.Status == SmtpStatusCode.Ok) { WriteLine("DATA "); Read(SmtpStatusCode.StartMailInput); WritePayload(message); WriteLine("."); response = Read(); } else { WriteLine("RSET"); Read(SmtpStatusCode.ServiceReady, SmtpStatusCode.Ok); } return(new Result( delivered: response.Status == SmtpStatusCode.Ok, recipient: addr, channel: channel, response: response )); }
public Result( bool delivered, MailAddress recipient, SmtpChannel channel = null, SmtpResponse response = null, Exception exception = null ) { Delivered = delivered; Recipient = recipient; if (channel != null) { MXDomain = channel.MxDomain; UsingSsl = channel.UsingSsl; } Response = response; Exception = exception; }