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.
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.