Click here to Skip to main content
6,595,444 members and growing! (21,341 online)
Email Password   helpLost your password?
Web Development » ASP.NET » Howto     Intermediate

System.Web.Mail and the pickup directory

By Daniel Fisher (lennybacon)

This article describes how to use System.Web.Mail with the SMTP server's pickup directory.
C#.NET 1.0, Win2K, WinXP, Win2003, ASP.NET, IIS 5.1, IIS 6, Dev
Posted:28 Dec 2004
Views:33,293
Bookmarked:25 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
8 votes for this article.
Popularity: 3.55 Rating: 3.93 out of 5
1 vote, 12.5%
1
1 vote, 12.5%
2

3
2 votes, 25.0%
4
4 votes, 50.0%
5

Introduction

When you send e-mail using System.Web.Mail and the local SMTP server, you can avoid the roundtrip to the network and use the pickup directory.

The Code

You can easily update your existing code. For example take this:

eMail = new MailMessage();
eMail.BodyFormat = MailFormat.Text;
eMail.To = "recipients@codeproject.com";
eMail.Body = _Body;
eMail.From = _SendFrom;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(eMail);

Just add two lines of code and you are done:

eMail = new MailMessage();
eMail.BodyFormat = MailFormat.Text;
eMail.To = "recipients@codeproject.com";
eMail.From = _SendFrom;
eMail.Body = _Body;
SmtpMail.SmtpServer = "localhost";
eMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]  = 1;
eMail.Fields[
  "http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory"] = 
  "C:\\Inetpub\\mailroot\\Pickup";
SmtpMail.Send(eMail);

Conclusion

Especially if you want to send loads of e-mails, like in a newsletter application, you should keep this in mind.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Daniel Fisher (lennybacon)


Member
Daniel Fisher is co-founder of devcoach. He supports since 1997 customers and projects in Germany and throughout Europe. As a consultant and developer he has worked several years on projects for insurance companies, distributors, mobile communications hardware, construction supplies and various other companies of different branches. He has a strong emphasis on service-orientation, agile methods, the web and data access. He is a frequent speaker on national and international software developer conferences in Germany, England and Poland. Daniel is actively contributing the software developer community as lead of a user group and organizer of the biggest regional software developer community event. You can read his blog by visiting lennybacon.com.
Occupation: Web Developer
Location: Germany Germany

Other popular ASP.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 9 of 9 (Total in Forum: 9) (Refresh)FirstPrevNext
GeneralScalability ? PinmemberCypher11:33 30 Jan '08  
GeneralRe: Scalability ? PinmemberDaniel Fisher (lennybacon)22:58 30 Jan '08  
GeneralReceiving E-mail PinmemberChristopher Norton11:33 13 Oct '05  
GeneralRe: Receiving E-mail PinsussAnonymous4:56 14 Oct '05  
GeneralNo Confirmation? PinmemberDanielHac16:01 8 Feb '05  
GeneralAuthentification? PinmemberUnruled Boy6:13 29 Dec '04  
GeneralRe: Authentification? PinmemberDaniel Fisher (lennybacon)11:44 30 Dec '04  
GeneralList of all fields? PinsitebuilderUwe Keim21:55 28 Dec '04  
GeneralRe: List of all fields? PinmemberDaniel Fisher (lennybacon)11:45 30 Dec '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 28 Dec 2004
Editor: Sumalatha K.R.
Copyright 2004 by Daniel Fisher (lennybacon)
Everything else Copyright © CodeProject, 1999-2009
Web09 | Advertise on the Code Project