0 votes

1.Could you please give an example of how to use SmtpResponse.Status

2.Could you also please give an example (in what situations) SendMessageStatus returns SendMessageStatus.Failure or PartialSucess.

Thank you!

by

1 Answer

0 votes

1.Could you please give an example of how to use SmtpResponse.Status

In most cases there is no need to use this class directly - it represents the SMTP server response to a single SMTP command.

SmtpResponse smtpResponse = smtp.SendCommand("NOOP");
if (smtpResponse.Status != SmtpResponseStatus.Positive)
    _log.Error("Command failed " + smtpResponse.Message);

2.Could you also please give an example (in what situations) SendMessageStatus returns SendMessageStatus.Failure or PartialSuccess.

  • SendMessageStatus.Failure is returned on SMTP server error,
  • SendMessageStatus.PartialSuccess is returned when message was sent to some recipients, but not all - the server responded with OK for some recipients, but rejected others. This status is returned only if Smtp.Configuration.AllowPartialSending is set to true.
by (301k points)
edited by
SendMessageStatus return values
...