2010-11-03

使用SmtpClient注意事項如果你不是使用.Net 4.0+

這個Bug源自於該功能不會自動Close or Dispose Session
只能等到自行Time out,這會造成有些e-mail不對而造成錯誤信息

解決方式其實很簡單,將MaxIdleTime設為0還有ConnectionLimit設為1就搞定囉!


SmtpClient.ServicePoint.MaxIdleTime = 0
SmtpClient.ServicePoint.ConnectionLimit = 1


如果想看官網回報可以看這裡
SmtpClient does not close session after sending message

0 comments: