How can I use a local SMTP server when developing

2019-01-21 07:56发布

问题:

How can I get SMTP to work on a Windows 7 development box? I used to just be able to turn on the IIS SMTP server on Windows XP. Is SMTP not included with Windows 7? If so, what can I use instead as a free relay mechanism?

回答1:

SMTP isn't included with Windows Vista, either - you'll have to download and install a free third-party SMTP server. There are a number available - http://www.softstack.com/freesmtp.html being one.

UPDATE: Some more options - Vista's IIS Instance doesn't have SMTP (Solutions?)



回答2:

If you are developing in ASP.net using the built-in mail libraries, a lesser-known configuration setting is to use the following:

<configuration>
. . . more config stuff here . . .     
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory" from="noreply@testdomain.org">
        <specifiedPickupDirectory pickupDirectoryLocation="c:\smtp\"/>
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

All your application generated emails will be dumped into this directory during development. No smtp server needed!



回答3:

You can use Google's as a free relay, however you need to have a Google account.

smtp.gmail.com

Just make sure the ports are setup as defined for your account.



回答4:

According to this post, the issue an SMTP server was included in IIS6, but has been removed in IIS7. This thread suggests the Remote Server Administration Tools (which include a SMTP server), as long as you don't have the Home edition of Windows.



回答5:

I use "Free SMTP Server" from Softstack.

http://www.softstack.com/freesmtp.html

HTH



回答6:

For those still coming across this, I've played with the two servers suggested above (freesmtp and hmailserver). Freesmtp is very quick and simple and worked out the box but only lets you send 10 emails a day without paying $69. hmailserver takes longer to set up (although still fairly painless) but has more features and hasn't asked me for money (yet).



回答7:

I had the same problem, and I installed hMailServer.
http://hmailserver.com/