| Details | ![]() |
| QuickDocId | 496 |
| Written by | Imar Spaanjaars |
| Posted | 07/03/2009 13:12 |
| Page views | 4541 |
Are you looking to hire an experienced software developer or .NET consultant? Then get in touch with me through my company's web site at devierkoeden.com
Found an interesting article on this site? Got inspired by something you read here? Then consider making a donation with PayPal.
In my experience, using a real mail server during development suffers from the following problems:
int index = 0;
while (index < myCustomerList.Length - 1)
{
mySmtpClient.Send(me, myCustomerList[i].Email, "Hello there", mailBody);
}
Ooops, forgot to update index. Now you have a very unhappy customer with a zillion e-mails in her Inbox..... ;-) (I know I can and should use foreach to prevent this problem, but the example is just meant to show the idea. Similar stuff happened in classic ASP when you looped over a RecordSet and forgot to call MoveNext, isn't that right Ane?)
I often see developers send mail to blah@test.com or somebody@nobody.com. Have you ever considered that these accounts could be real? What happens if there is somebody reading this account and decides to take the user name and password you sent out for a test drive? Oooops again.
Fortunately, there is a very easy way to prevent all this from happening: store the mail locally and then use a local client application to read them. Rather than having something like this in your .NET .config files:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="You@yourprovider.com">
<network host="smtp.yourprovider.com"/>
</smtp>
</mailSettings>
</system.net>
use something like this:
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory" from="You@yourprovider.com">
<specifiedPickupDirectory pickupDirectoryLocation="C:\TempMail"/>
</smtp>
</mailSettings>
</system.net>
From now on, your e-mail is dropped in the local folder C:\TempMail as .eml files. You can open them with Windows Mail (available on Windows Vista) or with Windows Live Mail (useful for, among other OS's, Windows 7 as it no longer ships with its own mail client). You need to create the pickup folder in advance as it's not created for you automatically.
This concept is not new at all. It just wasn't until recently that I realized how much better this option is....
Happy mailing!
Wonder where to go next?
You can read existing comments below
or you can post a comment yourself on this article.
Consider making a donation
Please consider making a donation using PayPal. Your donation helps me to pay the bills so I can keep running Imar.Spaanjaars.Com, providing fresh content as often as possible.
I am interested in what you have to say about this article. Feel free to post any comments, remarks or questions you may have about this article. The Talk Back feature is not meant for technical questions that are not directly related to this article. So, a post like "Hey, can you tell me how I can upload files to a MySQL database in PHP?" is likely to be removed. Also spam and unrealistic job offers will be deleted immediately.
When you post a comment, you have to provide your name and the comment. Your e-mail address is optional and you only need to provide it if you want me to contact you. It will not be displayed along with your comment. I got sick and tired of the comment spam I was receiving, so I have protected this page with a simple calculation exercise. This means that if you want to leave a comment, you'll need to complete the calculation before you hit the Post Comment button.
If you want to object to a comment made by another visitor, be sure to contact me and I'll look into it ASAP. Don't forget to mention the page link, or the QuickDocId of the document.
For more information about the Talk Back feature, check out this news item.
| QuickDocId | 496 |
| Full URL | http://imar.spaanjaars.com/496/using-a-local-pickup-folder-for-email-delivery |
| Short cut | http://imar.spaanjaars.com/496/ |
| Written by | Imar Spaanjaars |
| Date Posted | 07/03/2009 13:12 |