using System.Net.Mail.SmtpClient;
using System.Net.MailMessage;
protected void btnSendmail_Click(object sender, EventArgs e)
{
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);
smtpClient.Host = "localhost";
smtpClient.Port = 25;
message.From = fromAddress;
message.To.Add("admin1@yoursite.com");
message.Subject = "Feedback";
message.CC.Add("admin1@yoursite.com");
message.CC.Add("admin2@yoursite.com");
message.Bcc.Add(new MailAddress("admin3@yoursite.com"));
message.Bcc.Add(new MailAddress("admin4@yoursite.com"));
message.IsBodyHtml = false;
message.Body = txtMessage.Text;
smtpClient.Send(message);
lblStatus.Text = "Email successfully sent.";
}
catch (Exception ex)
{
lblStatus.Text = "Send Email Failed." + ex.Message;
}
}