Email from .Net
This looks more useful for 2.0 of the framework...
http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx
The primary api ( system.net.mail)
even has its own web portal
http://www.systemnetmail.com/
EventsThere are no upcoming eventsOlder StoriesFriday 23-SepMonday 05-SepSaturday 20-AugWednesday 13-JulSaturday 25-JunWednesday 22-JunSunday 08-MayThursday 10-FebWednesday 17-Nov |
Welcome to Woods Applied Technologies Email from .NetThis looks more useful for 2.0 of the framework... http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx The primary api ( system.net.mail) even has its own web portal http://www.systemnetmail.com/ Story OptionsTrackbackTrackback URL for this entry: http://www.watcorp.com/trackback.php?id=20060620193844585 No trackback comments for this entry.Email from .Net
Authored by: cary on
Tuesday, June 20 2006 @ 09:49 PM MDT
Sending Email with System.Net.Mail
.NET 2.0 includes much richer Email API support within the System.Net.Mail code namespace. I've seen a few questions from folks wondering about how to get started with it. Here is a simple snippet of how to send an email message from “sender@foo.bar.com” to multiple email recipients (note that the To a CC properties are collections and so can handle multiple address targets): MailMessage message = new MailMessage(); message.From = new MailAddress("sender@foo.bar.com"); message.To.Add(new MailAddress("recipient1@foo.bar.com")); message.To.Add(new MailAddress("recipient2@foo.bar.com")); message.To.Add(new MailAddress("recipient3@foo.bar.com")); message.CC.Add(new MailAddress("carboncopy@foo.bar.com")); message.Subject = "This is my subject"; message.Body = "This is the content"; SmtpClient client = new SmtpClient(); client.Send(message); System.Net.Mail reads SMTP configuration data out of the standard .NET configuration system (so for ASP.NET applications you’d configure this in your application’s web.config file). Here is an example of how to configure it: <system.net> <mailSettings> <smtp from="test@foo.com"> <network host="smtpserver1" port="25" userName="username" password="secret" defaultCredentials="true" /> </smtp> </mailSettings> </system.net> |
|
Copyright © 2010 Woods Applied Technologies All trademarks and copyrights on this page are owned by their respective owners. |
Powered By Geeklog Created this page in 0.11 seconds |