public void sendMail(string toList, string fromlist, string ccList, string subject, string body) { MailMessage message = new MailMessage(); SmtpClient smtpClient = new SmtpClient(); MailAddress fromAddress = new MailAddress(fromlist); message.From = fromAddress; message.To.Add(toList); if (ccList != null && ccList != string.Empty) { message.CC.Add(ccList); } message.Subject = subject; message.IsBodyHtml = true; message.Body = body; smtpClient.Host = "127.0.0.1"; smtpClient.Port = 25; smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new System.Net.NetworkCredential(txtfromadd.Text, txtpwd.Text); smtpClient.Send(message); } protected void btnSubmit_Click(object sender, EventArgs e) { //string fromadd = txtfromadd.Text; string tocc = "suguna@cavintek.com"; sendMail(txtToAddress.Text, txtfromadd.Text, tocc, txtSubject.Text, txtContent.Text); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)