Click here to Skip to main content
12,829,103 members (39,933 online)
Click here to Skip to main content
Add your own
alternative version

Stats

47.3K views
27 bookmarked
Posted 28 Dec 2004

System.Web.Mail and the pickup directory

, 28 Dec 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Daniel Fisher (lennybacon)
Software Developer
Germany Germany
Beginning of the nineties started to assemble computers and configure networks. Automation lead to batching and scripting. Arrived on the other side of the trench the HTTP protocol is a constant companion. the journey began with JavaScript, then Perl, PHP and ASP with Visual Basic 5 and JScript, ending with Java and C++. End of the nineties starting to focus .NET, streaked Python, and now JavaScript again. He develops, teaches, trains, coaches and speaks. His topics: HTML5 & Web, Data Access & Performance, Scalable & Testable Designs, Distributed Systems & Services, Security & Trust.

You may also be interested in...

Comments and Discussions

 
QuestionScalability ? Pin
Cypher30-Jan-08 11:33
memberCypher30-Jan-08 11:33 
AnswerRe: Scalability ? Pin
Daniel Fisher (lennybacon)30-Jan-08 22:58
memberDaniel Fisher (lennybacon)30-Jan-08 22:58 
GeneralReceiving E-mail Pin
Christopher Norton13-Oct-05 11:33
memberChristopher Norton13-Oct-05 11:33 
GeneralRe: Receiving E-mail Pin
Anonymous14-Oct-05 4:56
sussAnonymous14-Oct-05 4:56 
QuestionNo Confirmation? Pin
DanielHac8-Feb-05 16:01
memberDanielHac8-Feb-05 16:01 
QuestionAuthentification? Pin
Unruled Boy29-Dec-04 6:13
memberUnruled Boy29-Dec-04 6:13 
AnswerRe: Authentification? Pin
Daniel Fisher (lennybacon)30-Dec-04 11:44
memberDaniel Fisher (lennybacon)30-Dec-04 11:44 
QuestionList of all fields? Pin
Uwe Keim28-Dec-04 21:55
sitebuilderUwe Keim28-Dec-04 21:55 
AnswerRe: List of all fields? Pin
Daniel Fisher (lennybacon)30-Dec-04 11:45
memberDaniel Fisher (lennybacon)30-Dec-04 11:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.170326.1 | Last Updated 28 Dec 2004
Article Copyright 2004 by Daniel Fisher (lennybacon)
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid