NET Email Validation
UserMessages Property
Example 






KellermanSoftware.NetEmailValidation Namespace > EmailValidation Class : UserMessages Property
Change user messages for validation errors
Syntax
'Declaration
 
Public Property UserMessages As System.Collections.Generic.Dictionary(Of UserMessageType,String)
'Usage
 
Dim instance As EmailValidation
Dim value As System.Collections.Generic.Dictionary(Of UserMessageType,String)
 
instance.UserMessages = value
 
value = instance.UserMessages
public System.Collections.Generic.Dictionary<UserMessageType,string> UserMessages {get; set;}
public read-write property UserMessages: System.Collections.Generic.Dictionary; 
public function get,set UserMessages : System.Collections.Generic.Dictionary
public: __property System.Collections.Generic.Dictionary<UserMessageType,string*>* get_UserMessages();
public: __property void set_UserMessages( 
   System.Collections.Generic.Dictionary<UserMessageType,string*>* value
);
public:
property System.Collections.Generic.Dictionary<UserMessageType,String^>^ UserMessages {
   System.Collections.Generic.Dictionary<UserMessageType,String^>^ get();
   void set (    System.Collections.Generic.Dictionary<UserMessageType,String^>^ value);
}
Remarks

Default Values

UserMessageType.ThankYou = "Thank you for entering a valid email address."
UserMessageType.BlackListed = "Please enter a different email address. The domain \"0}\" or email is on our black list."
UserMessageType.EmailAddressBlank = "Email address blank. Please enter an email address."
UserMessageType.ExceptionOccurred = "An exception occurred while validating the email address \"0}\" please notify the system administrator."
UserMessageType.FailedBasicSyntax = "The format of the email address is invalid. Please check @ and periods."
UserMessageType.FailedPublicWebsite = "The domain \"0}\" does not have an associated public website. Please enter a different email address."
UserMessageType.FailedCurseWords = "Curse words have been detected in your email address. This is not allowed on our system."
UserMessageType.FailedDisposableEmail = "Disposable email addresses are not allowed on this system. Please enter a different email address."
UserMessageType.FailedFreeEmail = "Our security policies prohibit the use of free email addresses. Please enter a different email address."
UserMessageType.FailedTypo = "The domain \"0}\" is invalid. Please check for typos."
UserMessageType.FailedFakeEmailPatternMatcher = "Fake email detected. Please enter a real email address. Fake Email Pattern Checker Rev 1.23."
UserMessageType.FailedKnownDomainEnding = "The domain \"0}\" is not a known domain. Please enter a valid email address."
UserMessageType.FailedMailboxCheck = "The user \"0}\" does not have a valid mailbox on \"1}\". Please enter a valid email address."
UserMessageType.FailedMailServerExists = "Could not find an email server for the domain \"0}\". Please enter a valid email address."
UserMessageType.FailedSmtpConnect = "Could not connect to the mail server for the domain \"0}\". Please enter a different email address."
UserMessageType.Blocked = "The domain \"0}\" is actively blocking email from our server. Please enter a different email address."
UserMessageType.MailboxQuotaExceeded = "The email address \"0}\" currently cannot receive email. Please enter a different email address."
UserMessageType.TimeoutExceeded = "The mail server \"0}\" did not respond in a timely manner."
UserMessageType.NoMxRecordsFound = "No Mx Records Found"
UserMessageType.Greylisted = "Grey Listed server, cannot determine if email is valid. Assuming valid."
UserMessageType.Restricted = "Restricted or busy server, cannot determine if email is valid. Assuming valid."
UserMessageType.Unresponsive = "Unresponsive server, cannot determine if email is valid. Assuming valid."
UserMessageType.OverQuota = "Mailbox over quota, assuming valid." UserMessageType.FailedCatchAllDomainCheck =, "Could not perform a catch all domain check for the domain \"{0}\""

Example
EmailValidation valid = new EmailValidation();
valid.FromEmail = "jane.doe@hotmail.com";
valid.FromMailServer = "mail.hotmail.com";
 
string userMessage = "The email address entered is in an invalid format.  Please try again.";
valid.UserMessages[UserMessageType.FailedBasicSyntax] = userMessage;
List<ValidationOptions> options = valid.NoConnectOptions;
Result result = valid.ValidEmail("john.doe@@hotmail.com", options);
Console.WriteLine(result.UserMessage);
Dim valid As New EmailValidation()
valid.FromEmail = "jane.doe@hotmail.com"
valid.FromMailServer = "mail.hotmail.com"
 
Dim userMessage As String = "The email address entered is in an invalid format.  Please try again."
valid.UserMessages(UserMessageType.FailedBasicSyntax) = userMessage
Dim options As List(Of ValidationOptions) = valid.NoConnectOptions
Dim result As Result = valid.ValidEmail("john.doe@@hotmail.com", options)
Console.WriteLine(result.UserMessage)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

EmailValidation Class
EmailValidation Members