When you install IIS on Windows 7, it doesn't include an SMTP mail server. That's different than Windows XP, and is inconvenient when you're developing -- and would like to test -- a .NET application that sends email.
Of course you could install and configure a third-party SMTP server, and there are some free ones available. But I found a simpler alternative here.
In brief, put this in your web.config file:
<smtp deliverymethod="SpecifiedPickupDirectory">
<specifiedpickupdirectory pickupdirectorylocation="c:\Temp\">
</smtp>
In your .NET application, instantiate SmtpClient using the constructor that takes no arguments; this tells SmtpClient to use the SMTP settings in web.config. Then, when your application calls SmtpClient.Send(), an .EML file will be created in c:\temp. I was able to double-click the .EML file, and it opened in Windows Live Email.
No comments:
Post a Comment