Hello,
I'm trying to create a script where when a user clicks on a button, it will send them an email.. The code compiles, however, when I click on the button it says "Failure sending mail" Here is the code:
private void button1_Click(object sender, EventArgs e)
{
string mailServerName = "smtphost";
string from = "example@example.com";
string to = "example@example.com";
string subject = "mailings";
string body = "this is a test, this is a test";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient mailClient = new SmtpClient(mailServerName)
mailClient.UseDefaultCredentials = true;
// Send delivers the message to the mail server
mailClient.Send(message);
}
Please help, thanks