-
Notifications
You must be signed in to change notification settings - Fork 351
Installation
If you don't want to use the dotnet global tool or Docker (see below if you know what those mean), you can download a standalone (or .NET Core runtime dependent) release from github.
- Download a release and unzip. To choose the right file, refer to the table below:
Prefix | Description |
---|---|
Rnwood.Smtp4dev-win-x64 | Windows x64 (Intel 64 bit) binary standalone |
Rnwood.Smtp4dev-noruntime | Architecture dependent version. Should run on any platform where the .NET 8+ runtime is installed |
Rnwood.Smtp4dev-linux-x64 | Linux x64 (Intel 64 bit) binary standalone |
Rnwood.Smtp4dev-linux-musl-x64 | Linux x64 (Intel 64 bit) binary standalone for MUSL based distros (Alpine Linux) |
Rnwood.Smtp4dev-linux-arm | Linux ARM (Intel 32 bit) binary standalone |
Rnwood.Smtp4dev-osx-x64 | Currently unavailable due to changes in OSX that force signing. |
Rnwood.Smtp4dev-win-arm | Windows ARM 32-bit binary standalone |
-
On Linux
chmod +x
theRnwood.Smtp4dev
file to make it executable -
Edit
appsettings.json
and set the port number you want the SMTP server to listen on. -
Run
Rnwood.Smtp4dev
(.exe
on Windows). (If you downloaded thenoruntime
version, you need the .NET Core 3.1 (.NET 6.0 if using smtp4dev version >= 3.2.x) runtime on your machine and you should executedotnet Rnwood.Smtp4dev.dll
to run it.)
Once the service is running, access to the app's interface via a browser.
- The default port is 5000, open your browser at
http://localhost:5000
.
To run the webserver on a different port or make it listen on interfaces other than loopback, add the command line arg --urls "http://0.0.0.0:5001/"
when starting the executable.
If you're using the .NET 8+ SDK you can install smtp4dev as a global tool using the following command:
dotnet tool install -g Rnwood.Smtp4dev
The above will install the most recent non pre-release version.
If you want to use the pre-release development versions, add --prerelease
Then you can start smtp4dev by running
smtp4dev
Docker images for both Windows and Linux are available. To run with the web interface on port 5000 and SMTP on port 2525:
docker run --rm -it -p 5000:80 -p 2525:25 rnwood/smtp4dev
Remove --rm -it
if you want to leave smtp4dev running in the background, otherwise it will run until you hit CTRL+C.
The above will install the most recent non pre-release version. If you want to use the pre-release development versions use rnwood/smtp4dev:prerelease
. Both 'latest' and 'prerelease' are cross platform tag which will work on either Windows x64 or Linux x64. To see the full list of available tags see the Docker hub page for smtp4dev.
The folder /smtp4dev
will be used for the database and auto-generated TLS certificate. You can mount a directory outside of the container here for peristent storage.
An example docker-compose.yml
can be found here.
Download one the Windows standalone versions which is applicable for your OS/architecture.
New-Service -Name Smtp4dev -BinaryPathName "{PathToExe} --service"
sc.exe create Smtp4dev binPath= "{PathToExe} --service"
Make sure you have installed the ASP.NET Core Runtime - Windows Hosting Bundle so that IIS can host ASP.NET Core apps.
Also make sure the IIS application pre-initialisation feature is installed.
Download a smtp4dev release and unzip. You must pick the noruntime
version.
Create a site in IIS and set the root path to where you unzipped smtp4dev (do not point at wwwroot
or ClientApp
). You can also host in a virtual directory under another site, but don't forget to convert the directory to an application.
Grant permission to the IIS app pool to read the files. The principal name is IIS APPPOOL\<name>
where <name>
is the name of the app pool, which is the name of the site you created unless you changed something.
Edit the application pool advanced settings and ensure:
- '.NET CLR version' is set to 'No managed code'
- 'Start Mode' is set to 'AlwaysRunning'
- 'Idle Time-out (minutes)' is set to '0'
- Recycling > 'Regular Time Interval (minutes)' is set to '0'
- 'Preload enabled' is set to 'True'.
You can then access the site via the ports/hostname set in bindings that are set in IIS. If you see an error check the Application
event log for details and you'll see any errors output from IIS.