SmtpClient get result from server on send

后端 未结 3 804
谎友^
谎友^ 2021-01-17 10:21

The SmtpClient send method returns void. Is there any way to get the server response? Do I just assume it was successful unless it throws an exception?

The class I\

3条回答
  •  没有蜡笔的小新
    2021-01-17 10:58

    You assume that it was successful unless it throws... although success in this case only means that it was accepted by the mail server, anything else is then up to the server...

    IF you want a little bit of control you can use SendAsync and hook the SendCompleted event...

提交回复
热议问题