Skip to content

Commit b62704d

Browse files
committed
Merge branch 'develop' of https://github.com/ChangemakerStudios/Papercut-SMTP into develop
2 parents cb46263 + 3c7d2a8 commit b62704d

7 files changed

Lines changed: 145 additions & 8 deletions

File tree

GitVersion.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
mode: ContinuousDelivery
1+
mode: ContinuousDelivery
2+
branches:
3+
feature:
4+
increment: Patch
5+
develop:
6+
increment: Patch

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,20 @@ Papercut SMTP UI Requires the "WebView2" Microsoft shared system component to be
3333

3434
## (Optional) Download Papercut SMTP Service
3535
Papercut SMTP has an optional HTTP server to receive emails even when the client is not running.
36-
It can be run in an almost portable way by downloading [Papercut.Smtp.Service.*.zip](https://github.com/ChangemakerStudios/Papercut/releases), unzipping, and [following the service installation instructions](https://github.com/ChangemakerStudios/Papercut/tree/develop/src/Papercut.Service).
36+
It can be run in an almost portable way by downloading [Papercut.Smtp.Service.*.zip](https://github.com/ChangemakerStudios/Papercut-SMTP/releases), unzipping, and installing as a Windows Service.
37+
38+
### Installing Papercut SMTP Service
39+
40+
1. **Download** the appropriate [Papercut.Smtp.Service.*.zip](https://github.com/ChangemakerStudios/Papercut-SMTP/releases) for your system (win-x64 or win-x86)
41+
2. **Extract** the zip file to your desired location
42+
3. **Run the installation script** (requires administrator privileges):
43+
- **Option A:** Double-click `install-papercut-service.bat`
44+
- **Option B:** Run `install-papercut-service.ps1` in PowerShell
45+
4. The service will be installed and configured to **start automatically** on system boot
46+
47+
**To uninstall:** Run `uninstall-papercut-service.bat` or `uninstall-papercut-service.ps1`
48+
49+
For more details, see the [Service Installation Guide](https://github.com/ChangemakerStudios/Papercut-SMTP/tree/develop/src/Papercut.Service).
3750

3851
### Host in Docker
3952

build.cake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ Task("BuildAndPackServiceWin64")
262262

263263
DotNetPublish("./src/Papercut.Service/Papercut.Service.csproj", settings);
264264

265-
CopyFiles("./extra/*.ps1", publishDirectory);
265+
CopyFiles("./extras/*.ps1", publishDirectory);
266+
CopyFiles("./extras/*.bat", publishDirectory);
266267

267268
var destFileName = new DirectoryPath(releasesDirectory).CombineWithFilePath($"Papercut.Smtp.Service.{versionInfo.FullSemVer}-{runtime}.zip");
268269
Zip(publishDirectory, destFileName, GetFiles(publishDirectory.ToString() + "/**/*"));
@@ -289,7 +290,8 @@ Task("BuildAndPackServiceWin32")
289290

290291
DotNetPublish("./src/Papercut.Service/Papercut.Service.csproj", settings);
291292

292-
CopyFiles("./extra/*.ps1", publishDirectory);
293+
CopyFiles("./extras/*.ps1", publishDirectory);
294+
CopyFiles("./extras/*.bat", publishDirectory);
293295

294296
var destFileName = new DirectoryPath(releasesDirectory).CombineWithFilePath($"Papercut.Smtp.Service.{versionInfo.FullSemVer}-{runtime}.zip");
295297
Zip(publishDirectory, destFileName, GetFiles(publishDirectory.ToString() + "/**/*"));
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@echo off
2+
REM Papercut SMTP Service - Installation Script
3+
REM This batch file wrapper runs the PowerShell installation script
4+
5+
echo.
6+
echo ========================================
7+
echo Papercut SMTP Service - Installation
8+
echo ========================================
9+
echo.
10+
11+
REM Get the directory where this script is located
12+
set "SCRIPT_DIR=%~dp0"
13+
14+
REM Check if PowerShell script exists
15+
if not exist "%SCRIPT_DIR%install-papercut-service.ps1" (
16+
echo ERROR: Could not find install-papercut-service.ps1
17+
echo Please ensure the PowerShell script is in the same directory as this batch file.
18+
echo.
19+
pause
20+
exit /b 1
21+
)
22+
23+
REM Run the PowerShell script with elevated privileges
24+
echo Running installation script...
25+
echo.
26+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%install-papercut-service.ps1"
27+
28+
REM Check if PowerShell execution failed
29+
if errorlevel 1 (
30+
echo.
31+
echo ERROR: Installation script failed to execute.
32+
echo Please ensure you have PowerShell installed and try running as Administrator.
33+
echo.
34+
pause
35+
exit /b 1
36+
)
37+
38+
exit /b 0
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@echo off
2+
REM Papercut SMTP Service - Uninstallation Script
3+
REM This batch file wrapper runs the PowerShell uninstallation script
4+
5+
echo.
6+
echo ========================================
7+
echo Papercut SMTP Service - Uninstallation
8+
echo ========================================
9+
echo.
10+
11+
REM Get the directory where this script is located
12+
set "SCRIPT_DIR=%~dp0"
13+
14+
REM Check if PowerShell script exists
15+
if not exist "%SCRIPT_DIR%uninstall-papercut-service.ps1" (
16+
echo ERROR: Could not find uninstall-papercut-service.ps1
17+
echo Please ensure the PowerShell script is in the same directory as this batch file.
18+
echo.
19+
pause
20+
exit /b 1
21+
)
22+
23+
REM Run the PowerShell script with elevated privileges
24+
echo Running uninstallation script...
25+
echo.
26+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%uninstall-papercut-service.ps1"
27+
28+
REM Check if PowerShell execution failed
29+
if errorlevel 1 (
30+
echo.
31+
echo ERROR: Uninstallation script failed to execute.
32+
echo Please ensure you have PowerShell installed and try running as Administrator.
33+
echo.
34+
pause
35+
exit /b 1
36+
)
37+
38+
exit /b 0

src/Papercut.Service/Readme.md

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
11
## How to Run Papercut.Service
22

3-
- Option 1:
4-
Run from the command line by entering: `Papercut.Service.exe`
5-
- Option 2: Install as a service with the command `Install-Papercut-Service.bat` and the service will be installed. Enter `Papercut.Service.exe install --sudo` to immediately start the service.
3+
### Option 1: Run as Console Application
4+
Run from the command line by entering:
5+
```
6+
Papercut.Service.exe
7+
```
68

7-
A listing of all command line options are avaliable by entering: `Papercut.Service.exe help`
9+
### Option 2: Install as Windows Service (Recommended)
10+
11+
The service can be installed to run automatically on Windows startup.
12+
13+
#### Using the Installation Scripts:
14+
15+
**For PowerShell users:**
16+
```powershell
17+
.\install-papercut-service.ps1
18+
```
19+
20+
**For Command Prompt users:**
21+
```cmd
22+
install-papercut-service.bat
23+
```
24+
25+
Both scripts will:
26+
- Require administrator privileges (will prompt if needed)
27+
- Validate that Papercut.Service.exe exists
28+
- Install the service with automatic startup configured
29+
- Start the service immediately
30+
31+
#### Uninstalling the Service:
32+
33+
**PowerShell:**
34+
```powershell
35+
.\uninstall-papercut-service.ps1
36+
```
37+
38+
**Command Prompt:**
39+
```cmd
40+
uninstall-papercut-service.bat
41+
```
42+
43+
#### Manual Installation (Advanced):
44+
You can also install the service manually using `sc.exe`:
45+
```cmd
46+
sc.exe create Papercut.Smtp.Service binPath= "C:\path\to\Papercut.Service.exe" DisplayName= "Papercut SMTP Service" start= auto
47+
sc.exe start Papercut.Smtp.Service
48+
```
849

950
## How to Configure Papercut.Service
1051

0 commit comments

Comments
 (0)