An error similar to the following may occur when sending
emails to multiple recipients through ASP.NET and SMTPClient.
System.Net.Mail.SmtpFailedRecipientException:
Insufficient system storage
Most mail servers have a fixed limit on the maximum amount of recipients per
session. The SMTPClient class in .NET 2.0 uses connection pooling so multiple
messages may use the same connection even if the SMTPClient object is created
each time.
The best approach to this issue is to use error handling to catch the specific
error message and resend.
VB.NET Example
|
Dim s As New SmtpClient
Dim m As New MailMessage
s.Host = "localhost"
s.Port = 25
Try
s.Send(m)
Catch ex As SmtpException
If ex.StatusCode = SmtpStatusCode.InsufficientStorage Then
'Send again to ensure this email gets sent
s.Send(m)
Else
'Handle other SMTP errors here.
Response.Write("Error: " & ex.Message)
End If
End Try
|