Basically all I want to do this take the applicant email address out and from the txtEmailAddress.Text field and sent them an automatic response. The code is below but im getting some compile errors. Anyone know how to fix it or have code to do what I want to do.
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress toAddress = new MailAddress(txtEmailAddress.Text);
// You can specify the host name or ipaddress of your server
// Default in IIS will be localhost
smtpClient.Host = "www.colaistenamumhan.ie";
//Default port will be 25
smtpClient.Port = 25;
//From address will be given as a MailAddress Object
message.From("
[email protected]");
// To address collection of MailAddress
message.To = toAddress;
message.Subject = "Foirm Iarratais - Booking Form";
//Body can be Html or text format
//Specify true if it is html message
//message.IsBodyHtml = false;
// Message body content
message.Body = "Your details have been entered into the database. We will contact you shortly, once your details have been verified and processed. Tá do chuid sonraà againn anois. Beifear i dteagmháil leat a luaithe agus a bheidh do fhoirm iarrtais fÃoraithe. Is mór againn gur roghnaigh tú Coláiste na Mumhan. TaÃmÃd ag tnúth le tú a fheiscint i mBéal Ãtha an Ghaorthaidh. Bain TAITNEAMH agus TAIRFE as do chuairt. We appreciate your choosing Coláiste Na Mumhan. We look forward to meeting you. GO RAIBH MAITH AGAT.";
// Send SMTP mail
smtpClient.Send(message);
lblStatus.Text = "Email successfully sent.";
}
catch (Exception ex)
{
lblStatus.Text = "Send Email Failed." + ex.Message;
}