One of the streams has already been used and can't be reset to the origin.
在透過C# SMTP API寄發信件通知時候
若有附件
這時候若處裡不當
就可能拋出這個例外錯誤
Before
由於例外發生在
Attachment只要SMTP使用完後做Dispose也會連動將MemoryStream給清空
因此應放置於迴圈內每次初始
After
Ref:
SMTPException One of the streams has already been used and can't be reset to the origin
留言
張貼留言