An easy way to send mail from .NET is to use the DnsMailClient class. Here's some sample code in both C# and VB:
// in C#
MailMessage msg = new MailMessage();
msg.From = "sender@mail.com";
msg.To = "use1@mail.com;user2@mail.com";
msg.Subject = "dns sending";
msg.Body = "it is a test.";
DnsMailClient client = new DnsMailClient();
client.Send(msg);
' in VB.NET
Dim msg As MailMessage = New MailMessage()
msg.From = "sender@mail.com"
msg.To = "use1@mail.com;user2@mail.com"
msg.Subject = "dns sending"
msg.Body = "it is a test.
Dim client As DnsMailClient = New DnsMailClient()
client.Send(msg)
http://www.devx.com/tips/Tip/42487?trk=DXRSS_DOTNET
No comments:
Post a Comment