tmp/test-doxy-mms/MarekMailSystem/MarekMailSystem2/EmailStatus.cs

Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 using System.Net.Mail;
00005 
00006 namespace MarekMailSystem2
00007 {
00008 
00009     //TODO: konstruktor MailAddress rzucic moze ArgumentException! to tez trzeba uwzglednic!
00013     public enum StatusCode
00014     {
00018         NotSentYet,
00019         Sent, // The email was successfully sent to the SMTP service.
00020         InvalidFormat, // Some adresses are in invalid format.
00021         InvalidOperation,
00022         // This SmtpClient has a SendAsync call in progress.
00023         // -or- Host is a null reference
00024         // -or- Host is equal to the empty string ("").
00025         // -or- Port is zero.
00026         ArgumentNull, // one of: from, to, body  is null
00027         NoRecipients, // There are no recipients in To, CC, and BCC.
00028         ObjectDisposed, // This object has been disposed.
00029         SmtpFailed,
00030         // The connection to the SMTP server failed.
00031         // -or- Authentication failed.
00032         // -or- The operation timed out.
00033         // check SmtpStatus property for details!
00034         SmtpFailedRecipients // The message could not be delivered to
00035         // one or more of the recipients in To, CC, or BCC.
00036         // check SmtpStatus property for details!
00037     }
00038 
00039 
00044     public class EmailStatus
00045     {
00046         private StatusCode status = StatusCode.NotSentYet;
00047 
00048             public StatusCode Status
00049             {
00050                     get { return status;}
00051             }
00052 
00053         private SmtpStatusCode smtpStatus = SmtpStatusCode.Ok;
00054 
00058         public SmtpStatusCode SmtpStatus
00059         {
00060             get { return smtpStatus; }
00061         }
00062 
00063         private string errorMessage;
00064 
00065         public string ErrorMessage
00066         {
00067             get { return errorMessage; }
00068         }
00069         
00070 
00071         public EmailStatus(StatusCode Status, SmtpStatusCode SmtpStatus, string ErrorMessage)
00072         {
00073             status = Status;
00074             smtpStatus = SmtpStatus;
00075             errorMessage = ErrorMessage;
00076         }
00077         public EmailStatus(StatusCode Status, SmtpStatusCode SmtpStatus)
00078             : this(Status, SmtpStatus, null) { }
00079         public EmailStatus(StatusCode Status, string ErrorMessage)
00080             : this(Status, SmtpStatusCode.Ok, ErrorMessage) { }
00081         public EmailStatus(StatusCode Status)
00082             : this(Status, SmtpStatusCode.Ok, null) { }
00083 
00084         public EmailStatus() {}
00085 
00086         public override string ToString()
00087         {
00088             return
00089                 "Status: " + Status.ToString() + "\n" +
00090                 "SmtpStatus: " + SmtpStatus.ToString() + "\n" +
00091                 (ErrorMessage == null ? "" : ErrorMessage + "\n");
00092         }
00093     }
00094 }

Generated on Thu Oct 25 11:32:52 2007 for Marek Mail System by  doxygen 1.5.3-20071008