/// <summary> /// Checks if given email address is valid. If it is not a Messagebox informs the user to type in a valid one. /// If it is then sends the Email with the given message and subject to the given email address. /// </summary> /// <param name="mr">Mail repository that contains the users credentials.</param> private void Send(MailRepository mr) { var reg = new Regex(@"^\w+@(\w.)+[a-z]{2,3}$"); if (!reg.IsMatch(EmailVM.Email.Receiver)) { MessageBox.Show("Wrong email address."); return; } mr.SendEmail(EmailVM.Email); Close(); }