Skip to content

Commit

Permalink
Additional build platforms
Browse files Browse the repository at this point in the history
Move info to Github wiki and reference from README.
  • Loading branch information
rnwood committed Sep 9, 2020
1 parent 84a6284 commit ef1e35d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 86 deletions.
89 changes: 10 additions & 79 deletions README.md
@@ -1,94 +1,25 @@
# <img src='Rnwood.Smtp4dev/ClientApp/public/logo.png' alt='logo'/>
smtp4dev - the fake SMTP email server for development and testing.
**smtp4dev - the fake SMTP email server for development and testing.**

A dummy SMTP server for Windows, Linux, Mac OS-X (and maybe elsewhere where .NET Core is available). Lets you test your application without spamming your real customers and without needing to set up a complicated real email server with a special configuration. Messages received in smtp4dev can be viewed and inspected.

This repository hosts the development of v3 which has a web UI so that it can be shared amongst members of a team, and be available cross platform.
This version is in development, but now approaching a stable state.
*If you're looking for the older v2 Windows GUI version. [Grab it here](https://github.com/rnwood/smtp4dev/releases/tag/v2.0.10).*

**If you're looking for the older v2 Windows GUI version. [Grab it here](https://github.com/rnwood/smtp4dev/releases/tag/v2.0.10).**
> <a style="float: right" href="https://www.patreon.com/bePatron?u=38204828" data-patreon-widget-type="become-patron-button"><img alt='Become a Patreon' src='https://c5.patreon.com/external/logo/become_a_patron_button.png' height="30px"></a> <a style="float: right" href='https://www.paypal.me/rnwood'><img alt='Donate' src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png'/></a> *If you find smtp4dev useful, please consider supporting further development by making a donation*
> .
*If you find smtp4dev useful, please consider supporting further development by making a donation:*

<a href="https://www.patreon.com/bePatron?u=38204828" data-patreon-widget-type="become-patron-button"><img alt='Become a Patreon' src='https://c5.patreon.com/external/logo/become_a_patron_button.png'></a>
<a href='https://www.paypal.me/rnwood'><img alt='Donate' src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png'/></a>
## Getting Started
[Installation Instructions](https://github.com/rnwood/smtp4dev/wiki/Installation)

[Configuration](https://github.com/rnwood/smtp4dev/wiki/Configuration)

[Configuring your programs to send mails to smtp4dev](https://github.com/rnwood/smtp4dev/wiki/Configuring-Clients)

[![Build Status](https://dev.azure.com/smtp4dev/smtp4dev/_apis/build/status/rnwood.smtp4dev?branchName=master)](https://dev.azure.com/smtp4dev/smtp4dev/_build/latest?definitionId=2&branchName=master)
[![Github Releases](https://img.shields.io/github/downloads/rnwood/smtp4dev/latest/total.svg)](https://github.com/rnwood/smtp4dev/releases) (+270k when prev hosted on Codeplex)

## Screenshots

![Screenshot 1](screenshot1.png)
![Screenshot 2](screenshot2.png)


## How to run smtp4dev by downloading from github releases

*The MacOS release is totally untested. Please contribute instructions on how to use and feedback on any issues*

- Download [a release](https://github.com/rnwood/smtp4dev/releases) and unzip.

- On Linux `chmod +x` the `Rnwood.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 the ``noruntime`` version, you need the .NET Core 3.1 runtime on your machine and you should execute ``dotnet Rnwood.Smtpdev.dll`` to run it.)

- Open your browser at `http://localhost:5000` (to run the web server on a different port or make it listen on interfaces other than loopback, add the command line arg `--server.urls "http://0.0.0.0:5001/"` when starting the executable.

- Now configure your apps which send mail, to use the SMTP server on the machine where SMTP4dev is running (``localhost`` if they are on the same machine), and using the port you selected (``25`` by default).

## How to run smtp4dev as a dotnet global tool

If you're using the .NET Core SDK 3.1 or greater, you can install smtp4dev as a global tool using the following command:
```
dotnet tool install -g Rnwood.Smtp4dev --version "3.1.0-*"
```
Then you can start smtp4dev by running
```
smtp4dev
```


## How to run smtp4dev in Docker
Docker images for both Windows and Linux are available. To run with the web interface on port 3000 and SMTP on port 2525:

```
docker run -p 3000:80 -p 2525:25 rnwood/smtp4dev:v3
```
This is a cross platform tag which will work on either Windows or Linux. To see the full list of available tags [see the Docker hub page for smtp4dev](https://hub.docker.com/r/rnwood/smtp4dev/tags/).

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.

## How to run smtp4dev as a service (Windows only)

A service in Windows can be installed using New-Service in PowerShell, or sc in both command line or PowerShell. If you use sc in PowerShell, it must be run as sc.exe. sc is an alias for Set-Content.

## How to run smtp4dev in Windows IIS

Download a smtp4dev release and unzip. You must pick the win-x64 version.

Create a site in IIS and set the path to where you unzipped smtp4dev. 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 and modify 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 and set '.NET CLR version' to 'No managed code'

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.

### Install service in PowerShell

```
New-Service -Name Smtp4dev -BinaryPathName "{PathToExe} --service"
```

### Install service in Cmd or PowerShell

```
sc.exe create Smtp4dev binPath= "{PathToExe} --service"
```


### Configuration

smtp4dev configuration can be performed via `appsetting.json` file, environment variables and command line arguments. Run smtp4dev with `--help` for information or see the `appsettings.json` file.
46 changes: 39 additions & 7 deletions azure-pipelines.yml
Expand Up @@ -93,17 +93,29 @@ stages:
- powershell: move-item $(Build.ArtifactStagingDirectory)/linux-x64/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/linux-x64/Rnwood.Smtp4dev-linux-x64-$(tag).zip
displayName: Rename artifact
- publish: $(Build.ArtifactStagingDirectory)/linux-x64
artifact: linux-x64
artifact: linux-x64

- task: DotNetCoreCLI@2
displayName: Build .NET Core - osx-x64
displayName: Build .NET Core - linux-musl-x64
inputs:
command: publish
projects: Rnwood.Smtp4dev/Rnwood.Smtp4dev.csproj
arguments: '-c Release -r osx-x64 -p:version=$(tag) -o "$(Build.ArtifactStagingDirectory)/osx-x64"'
- powershell: move-item $(Build.ArtifactStagingDirectory)/osx-x64/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/osx-x64/Rnwood.Smtp4dev-osx-x64-$(tag).zip
arguments: '-c Release -r linux-musl-x64 -p:version=$(tag) -o "$(Build.ArtifactStagingDirectory)/linux-musl-x64"'
- powershell: move-item $(Build.ArtifactStagingDirectory)/linux-musl-x64/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/linux-musl-x64/Rnwood.Smtp4dev-linux-musl-x64-$(tag).zip
displayName: Rename artifact
- publish: $(Build.ArtifactStagingDirectory)/osx-x64
artifact: osx-x64
- publish: $(Build.ArtifactStagingDirectory)/linux-musl-x64
artifact: linux-musl-x64

# - task: DotNetCoreCLI@2
# displayName: Build .NET Core - osx-x64
# inputs:
# command: publish
# projects: Rnwood.Smtp4dev/Rnwood.Smtp4dev.csproj
# arguments: '-c Release -r osx-x64 -p:version=$(tag) -o "$(Build.ArtifactStagingDirectory)/osx-x64"'
# - powershell: move-item $(Build.ArtifactStagingDirectory)/osx-x64/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/osx-x64/Rnwood.Smtp4dev-osx-x64-$(tag).zip
# displayName: Rename artifact
# - publish: $(Build.ArtifactStagingDirectory)/osx-x64
# artifact: osx-x64
- task: DotNetCoreCLI@2
displayName: Build .NET Core - win-arm
inputs:
Expand All @@ -120,10 +132,30 @@ stages:
command: publish
projects: Rnwood.Smtp4dev/Rnwood.Smtp4dev.csproj
arguments: '-c Release -r linux-arm -p:version=$(tag) -o "$(Build.ArtifactStagingDirectory)/linux-arm"'
- powershell: move-item $(Build.ArtifactStagingDirectory)/linux-arm/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/linux-arm/Rnwood.Smtp4dev-noruntime-$(tag).zip
- powershell: move-item $(Build.ArtifactStagingDirectory)/linux-arm/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/linux-arm/Rnwood.Smtp4dev-arm-$(tag).zip
displayName: Rename artifact
- publish: $(Build.ArtifactStagingDirectory)/linux-arm
artifact: linux-arm
- task: DotNetCoreCLI@2
displayName: Build .NET Core - win-arm64
inputs:
command: publish
projects: Rnwood.Smtp4dev/Rnwood.Smtp4dev.csproj
arguments: '-c Release -r win-arm64 -p:version=$(tag) -o "$(Build.ArtifactStagingDirectory)/win-arm64"'
- powershell: move-item $(Build.ArtifactStagingDirectory)/win-arm64/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/win-arm64/Rnwood.Smtp4dev-win-arm64-$(tag).zip
displayName: Rename artifact
- publish: $(Build.ArtifactStagingDirectory)/win-arm64
artifact: win-arm64
- task: DotNetCoreCLI@2
displayName: Build .NET Core - linux-arm64
inputs:
command: publish
projects: Rnwood.Smtp4dev/Rnwood.Smtp4dev.csproj
arguments: '-c Release -r linux-arm64 -p:version=$(tag) -o "$(Build.ArtifactStagingDirectory)/linux-arm64"'
- powershell: move-item $(Build.ArtifactStagingDirectory)/linux-arm64/Rnwood.Smtp4dev.zip $(Build.ArtifactStagingDirectory)/linux-arm64/Rnwood.Smtp4dev-arm64-$(tag).zip
displayName: Rename artifact
- publish: $(Build.ArtifactStagingDirectory)/linux-arm64
artifact: linux-arm64

- job: DockerBuildLinux
displayName: DockerBuild - Linux
Expand Down

0 comments on commit ef1e35d

Please sign in to comment.