The System.Net.Mail namespace contains all the classes required for sending mail from within a .NET application. The SmtpClient class handles the actual sending of e-mail. For a simple mail, you can directly pass in the To address, from, subject, and body of the mail to one of the SmtpClient's overloaded send methods. Client application: private void btnSendMail_Click(object sender, EventArgs e) { MailService service = new MailService(); string from = "some@yahoo.com"; string to = "some@yahoo.com"; string subject = "Sending EMails from .NET 2.0"; string body = "Message Body"; service.SendMail(from, to, subject, body); ; MessageBox.Show("Done"); } Sending method: public void SendMail(string from, string to, string subject, string body) { string mailServerName = "yoursmtpserver"; try { //MailMessage represents the e-mail being sent using (MailMessage message = new MailMessage(from...
ASP.NET tips, problems and solutions discovered during development