try { string name = txt_name.Text; string email = txt_email.Text; string subject = txt_subject.Text; string msg = txt_area.Text; MailMessage m = new MailMessage(); SmtpClient sc = new SmtpClient(); m.From = new MailAddress("vehicletrack2013@gmail.com", "Vehicle Track"); m.Sender = new MailAddress(email, name); m.To.Add(new MailAddress(destination email)); m.To.Add(new MailAddress(destination email)); m.Subject = subject; m.Body = msg; //similarly BCC m.Subject = "Test"; m.Body = "This is a Test Mail"; sc.Host = "smtp.gmail.com"; sc.Port = 587; sc.Credentials = new System.Net.NetworkCredential(email id from where email send, password;); sc.EnableSsl = true; sc.Send(m); txt_name.Text = ""; txt_email.Text = ""; txt_subject.Text = ""; txt_area.Text = ""; alert_div.Visible = true; alert_span.InnerHtml = "Message has been submitted"; } catch (Exception ex) { alert_span.InnerHtml = "Could not send the e-mail"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)