【发布时间】:2017-12-26 03:51:10
【问题描述】:
我想发送通知:
- 成功
- 失败
- 延迟
当我发送电子邮件时。
不幸的是,DeliveryNotificationOptions 枚举似乎不包含执行所有这些操作的选项:
+---------------+----------------------------------------------------+
| Member Name | Description |
+---------------+----------------------------------------------------+
| Delay | Notify if the delivery is delayed. |
+---------------+----------------------------------------------------+
| Never | A notification should not be generated under |
| | any circumstances. |
+---------------+----------------------------------------------------+
| None | No notification information will be sent. The mail |
| | server will utilize its configured behavior to |
| | determine whether it should generate a delivery |
| | notification. |
+---------------+----------------------------------------------------+
| OnFailure | Notify if the delivery is unsuccessful. |
+---------------+----------------------------------------------------+
| OnSuccess | Notify if the delivery is successful |
+---------------+----------------------------------------------------+
我无法设置超过 1 个这样的选项:
Msg.DeliveryNotificationOptions += DeliveryNotificationOptions.Delay;
还有哪些其他选择?
我能想到的最好办法是使用 DeliveryNotificationOptions 的 IEnumerable 扩展 MailMessage,但我不太确定如何使用它。
这是一种可行的方法吗?
【问题讨论】:
标签: c# smtpclient mailmessage