/// <summary>Removes a previously added recipient.</summary> /// <param name="address"> /// The recipient's email <paramref name="address" /> . /// </param> public void RemoveToAddress(string address) { if (ToAddressList != null && !string.IsNullOrWhiteSpace(address)) { ToAddressList.Remove(address); } }
/// <summary>Adds a recipient to the message.</summary> /// <param name="address"> /// The recipient's email <paramref name="address" /> . /// </param> public void AddToAddress(string address) { if (ToAddressList == null) { ToAddressList = new List <string>(); } if (!string.IsNullOrWhiteSpace(address)) { ToAddressList.Add(address); } }
/// <summary>Validates the email message contains the minimum amount of data to succeed.</summary> /// <returns> /// <see langword="true" /> if the message contains the minimum amount of data needed to send successfully, /// <see /// langword="false" /> /// if it does not. /// </returns> internal bool Validate() { if (string.IsNullOrWhiteSpace(MessageBody)) { return(SetErrorMessage(string.Format(TheValueCannotBeEmpty, "Message Body"))); } if (string.IsNullOrWhiteSpace(FromAddress)) { return(SetErrorMessage(string.Format(TheValueCannotBeEmpty, "Send From Address"))); } if (ToAddressList.TrueForAll(string.IsNullOrWhiteSpace)) { return(SetErrorMessage(string.Format(AtLeastOneValueMustBeSpecified, "Send To Address"))); } return(true); }