I was coding a little tool to send our SDN newsletters and discovered the new SmtpMail stuff in .NET2.0. Now you don't need to code any stuff for setting your mailserver or credential. Just configure it!
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="mail.myserver.net"
port="25"
userName="Mark"
password="secret"/>
</smtp>
</mailSettings>
</system.net>
</configuration>
Now just send the message using the new classes in System.Net.Mail:
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
client.Send( message );