One of the nice but little known possibilities of the System.Net.Mail.SmtpClient class is the ability to drop emails into a location on disk. This makes it very easy to test your code without the need of an SMTP server.
Update your app.config or web.config like this:
1: <system.net>
2: <mailSettings>
3: <smtp deliveryMethod="SpecifiedPickupDirectory">
4: <specifiedPickupDirectory pickupDirectoryLocation="c:\mails\"/>
5: </smtp>
6: </mailSettings>
7: </system.net>
You can also configure this setting on the class itself. Files are dropped on the specified location and can be opened using Outlook Express or Windows Mail.

967

被折叠的 条评论
为什么被折叠?



