2
你好老友:)我有麻煩我怎麼才能重試發送失敗的電子郵件收件人。我正在嘗試在vbnet中創建一個應用程序,我可以將電子郵件發送到多個地址。VBNET smtp重試發送失敗的電子郵件地址
一些代碼片段:
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New Net.NetworkCredential(xInformation(0), xInformation(1))
SmtpServer.Port = CInt(xInformation(2))
SmtpServer.Host = xInformation(3)
SmtpServer.EnableSsl = True
Dim mail As New MailMessage()
mail = New MailMessage
mail.From = New MailAddress(xInformation(4), "Display Name")
mail.CC.Add(xInformation(5)) ' i will make a loop here to add recipients
mail.Subject = xInformation(6)
mail.IsBodyHtml = True
mail.Body = xInformation(7)
SmtpServer.Send(mail)
問題出現了:
1.) if i have to send, for instance, email to 5 recipients, and only
3 emails have been successfully sent, how can i know the
failed email addresses?
2.) where is the failed email address stored?
3.) what exceptions are needed to trapped this error?
哦,在這個應用程序,我並不需要檢查的反彈電子郵件。我只需要檢查smtp是否成功發送到服務器。我發現這篇文章,但我不知道如何轉換這個C#類。 http://leedumond.com/blog/retrying-mail-operations-in-net/ –