Smtp.NET 3 Documentation

SmtpServer.EmailReport Property

A DataSet that contains two tables: "good" and "bad"

[Visual Basic]
Public ReadOnly Property EmailReport As DataSet
public System.Data.DataSet EmailReport {get;}


This property is useful for recovery in the event of a catastrophic failure. The "bad" email addresses could also be for removal of those addresses from your list/database. This is not a email address validation feature, but rather a collection of email addresses that are accepted or rejected by the sending mail server.


            public void Send()
                 SmtpServer oSmtpDotNet = new SmtpServer();
                 // Set the remote server name.  If left blank, "localhost" is used.
                 oSmtpDotNet.ServerAddress = "";
                 // Message Addressing
                 oSmtpDotNet.ToAddress = "";
                 oSmtpDotNet.FromAddress = "";
                 // Set the message subject and body
                 oSmtpDotNet.Body = "This is the message";
                 oSmtpDotNet.Subject = "Routine email";
                 ReturnCodes nRC = oSmtpDotNet.Send();
                 if ( nRC != ReturnCodes.SUCCESS )
                      Console.WriteLine("Error #"+nRC+" occurred.");
                 // Success!
               // Use the email report
               DataTable oGood = new DataTable();
               oGood = EmailReport.Tables["good"];
               DataTable oBad = new DataTable();
               oBad = EmailReport.Tables["bad"];
            Public Function Send() As Integer
                 Dim oSmtpDotNet As New SmtpServer()
                 Dim nRC As ReturnCodes
                 ' Set the remote server name.  If left blank, "localhost" is used.
                 oSmtpDotNet.ServerAddress = ""
                 ' Message Addressing
                 oSmtpDotNet.FromAddress = ""
                 oSmtpDotNet.ToAddress = ""
                 ' Set the message subject and body
                 oSmtpDotNet.Subject = "Routine email"
                 oSmtpDotNet.Body = "This is a briefing of the financials"
                 ' Send the message.  Get the return code and store it in the variable
                 ' nRC.  Then check nRC for success or failure
                 nRC = oSmtpDotNet.Send()
                 If (nRC <> ReturnCodes.SUCCESS) Then
                     ' A problem occurred.
                     ' Write out the last error encountered
                     ' Write out the log file contents
                     Exit Function
                 End If
                 ' Success!
                 Console.WriteLine("Message Sent!")
               ' Use the EmailReport property
               Dim oGood As New DataTable()
               oGood = oSmtpDotNet.EmailReport.Tables("good")
               Dim oBad As New DataTable()
               oBad = oSmtpDotNet.EmailReport.Tables("bad")
            End Function

See Also

SmtpServer Class | SmtpServer Members | SmtpDotNet Namespace | Send