Click here to Skip to main content
Licence 
First Posted 28 Dec 2004
Views 39,806
Bookmarked 27 times

System.Web.Mail and the pickup directory

By | 28 Dec 2004 | Article
This article describes how to use System.Web.Mail with the SMTP server's pickup directory.

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)

Web Developer

Germany Germany

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.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionScalability ? PinmemberCypher10:33 30 Jan '08  
AnswerRe: Scalability ? PinmemberDaniel Fisher (lennybacon)21:58 30 Jan '08  
GeneralReceiving E-mail PinmemberChristopher Norton10:33 13 Oct '05  
GeneralRe: Receiving E-mail PinsussAnonymous3:56 14 Oct '05  
QuestionNo Confirmation? PinmemberDanielHac15:01 8 Feb '05  
QuestionAuthentification? PinmemberUnruled Boy5:13 29 Dec '04  
AnswerRe: Authentification? PinmemberDaniel Fisher (lennybacon)10:44 30 Dec '04  
QuestionList of all fields? PinsitebuilderUwe Keim20:55 28 Dec '04  
AnswerRe: List of all fields? PinmemberDaniel Fisher (lennybacon)10:45 30 Dec '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 28 Dec 2004
Article Copyright 2004 by Daniel Fisher (lennybacon)
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid