I want to validate SMTP host and port. Please let me know how can I do this? I want to smtp.gmail.com or smtp-mail.outlook.com. But now my code is allowing numbers also.
public int Smtp_Id{ get; set; }
[Display(Name="Mail From")]
[Required(ErrorMessage = "Please enter senders mail address.")]
[EmailAddress(ErrorMessage = "Invalid Email Address")]
public string Smtp_mailfrom { get; set; }
[Display(Name = "SMTP Host")]
[Required(ErrorMessage = "Please enter host name.")]
public string Smtp_Host { get; set; }
[Display(Name = "User Name")]
[Required(ErrorMessage = "Please enter username.")]
[MaxLength(50,ErrorMessage="Username Should not be more than 50 charachters.")]
public string Smtp_username { get; set; }
[Display(Name = "Password")]
[MaxLength(50, ErrorMessage = "Password Should not be more than 50 charachters.")]
[Required(ErrorMessage = "Please enter password.")]
public string Smtp_password { get; set; }
[Display(Name = "SMTP Port")]
[Required(ErrorMessage = "Please enter Port.")]
public int Smtp_Port { get; set; }