Demonstration
To send an SMTP message,
you simply instantiate an instance of the class, set
the appropriate data members and call the Send method.
static void Main( string[] args)
{
try
{
kbcafe.Smtp smtp = new kbcafe.Smtp();
smtp.server = "smtp.xxx.com";
smtp.from = "yyy@xxx.com (zzz)";
smtp.subject = "Hello World";
smtp.bodyHtml = "<HTML><BODY>Hello
World</BODY></HTML>";
smtp.to.Add("yyy@xxx.com");
smtp.Send();
}
catch( kbcafe.SmtpException e)
{
System.Console.WriteLine("{ 0}", e.What());
}
}
If you reuse this code, replace the xxx, yyy and zzz parameters by valid values.
A valid from address may be "someone@somewhere.com (Joe Bloggs)".