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 = "[email protected] (zzz)";
smtp.subject = "Hello World";
smtp.bodyHtml = "<HTML><BODY>Hello
World</BODY></HTML>";
smtp.to.Add("[email protected]");
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 "[email protected] (Joe Bloggs)
".
Comments