looking for an example of how to use authenticated SMTP with
ICredentialsByHost from.net 2.0 i found that there were no good examples
or even ANY examples actually, as a caring sharing type here was my eventual
solution !
You do not have to use ICredentialsByHost (i think thats mentioned enough
for the search engines !!)
public void doSend(string psFrom, string psContactList, string
psSubject)
{
try
{
MailMessage oMailMessage = new MailMessage(psFrom,
psContactList);
oMailMessage.Subject = psSubject + "-" + DateTime.Now;
oMailMessage.IsBodyHtml = true;
oMailMessage.Body = msHtmlString;
SmtpClient oSmtpClient = new
SmtpClient(ConfigurationSettings.AppSettings["SmtpServer"]);
NetworkCredential oNetworkCredential = new
NetworkCredential(ConfigurationSettings.AppSettings["SmtpUsername"],
ConfigurationSettings.AppSettings["SmtpPwd"]);
oSmtpClient.Credentials = oNetworkCredential;
oSmtpClient.Send(oMailMessage);
}
catch (Exception ex)
{
System.Windows.MessageBox.Show("error=" +
ex.Message+ex.Source+ex.InnerException+ex.StackTrace);
}
}
Stuck ? shout ! I'm Always busy, but always friendly
Vista & XAML fan ? get in touch.
craig kelly-soens - Windows Vista WinFx XAML .Net Evangelist
http://www.XpectWorld.com - for customised "super-easy to use" Windows Vista
based software