using System.Net.Mail;
using System.Windows.Forms;
..
void SendEMail
(string from, // e.g., "sender@csharp-online.net"
string to, // e.g., "receiver@csharp-online.net"
string subject,// e.g., "Please read this!"
string body) // e.g., "Thanks for the memories."
{
try
{ // Construct a new e-mail message
SmtpClient client = new SmtpClient (smtpClient);
client.Send (from, to, subject, body);
}
catch (SmtpException ex)
{
MessageBox.Show ( ex.Message, "SendEMail: " + ex.Message,
MessageBoxButtons.OK, MessageBoxIcon.Error );
}
}