I am building a hotel site for my final year project, I am trying to send an automated email to the customers once they have book.
used this code:
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(email.Text);
message.Subject = "Hotel Reservation";
message.From = new System.Net.Mail.MailAddress("Reservation@hotel.com");
message.Body = ("Dear" + first_name.Text + "Your reservation made for " + rates.Text +" " + nor.Text + " " + "is successful. Please print out this email for reference while checkin. Thank you");
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost"); smtp.Send(message);
when i run it shows me this error highlighting smtp.Send(message);:
SmtpException was unhandled by the user code and Failure sending mail.