/// <summary> /// Click event, Send a mail on the contact section. /// </summary> private void ContactSendButton_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(NameTextBox.Text) || String.IsNullOrEmpty(MailTextBox.Text) || String.IsNullOrEmpty(SubjectTextBox.Text) || String.IsNullOrEmpty(ContentTextBox.Text)) { Alert.AlertCreation("Fill Every Field!", AlertType.error); return; } else { string emailRegex = "^[a-zA-Z0-9_+&*-]+(?:\\." + "[a-zA-Z0-9_+&*-]+)*@" + "(?:[a-zA-Z0-9-]+\\.)+[a-z" + "A-Z]{2,7}$"; bool isEmail = Regex.IsMatch(MailTextBox.Text, emailRegex); if (isEmail) { bool result = informationParser.SendMail(mailSender, log, SubjectTextBox.Text, "Mail sender Name: " + NameTextBox.Text + "<br>" + "Mail Sender Address: " + MailTextBox.Text + "<br>" + ContentTextBox.Text, null); if (result) { Alert.AlertCreation("Mail has been sent.", AlertType.success); NameTextBox.Clear(); MailTextBox.Clear(); SubjectTextBox.Clear(); ContentTextBox.Clear(); } else { Alert.AlertCreation("Mail Problem. (Check SMTP)", AlertType.error); return; } } else { Alert.AlertCreation("Mail Address Format Problem.", AlertType.error); return; } } }