Tuesday, May 27, 2008

Send EMAIL through ASP.NET

//SmtpMail.SmtpServer = "127.0.0.1"; SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SmtpServer"]; System.Web.Mail.MailMessage msgMail = new System.Web.Mail.MailMessage(); msgMail.From = txtFrom.Text.ToString(); msgMail.To = txtTo.Text; msgMail.Cc = txtC.Text; msgMail.Bcc = txtBcc.Text; msgMail.Subject = txtSubject.Text; msgMail.Body = txtMessage.Text; msgMail.Attachments.Add(new MailAttachment(txtAttachment.Text)); SmtpMail.Send(msgMail);

No comments: