-
Install Stalwart Mail Server, if necessary.
Grab the latest zip file,
deploy it to a folder of your choice and
follow the instructions to initialize your installation.
For this tutorial, we placed the server's files in "C:\Stalwart Mail". Your folder may be different.
After you're done installing, ensure that you can open the Stalwart administrative console in your browser:
Log in and make sure everything looks good.
-
Next, download and install AlwaysUp, if necessary.
-
Start AlwaysUp.
-
Select Application > Add to open the Add Application window:
-
On the General tab:
-
In the Application field, enter the full path to the Stalwart Mail Server executable, stalwart-mail.exe.
That path is "C:\Stalwart Mail\bin\stalwart-mail.exe" on our system.
-
In the Arguments field, you should point the mail server to you configuration (*.toml) file. Enter:
--config="[PATH TO CONFIG FILE]"
For example, we'll enter --config="C:\Stalwart Mail\etc\config.toml" for our server. Your value should be similar.
Be sure to put quotes around the configuration file path if it contains a space!
-
In the Start the application field, choose Automatically, but shortly after the computer boots.
This option instructs Windows to launch Stalwart Mail Server a couple of minutes after your computer boots — after
all the machine's critical services are ready.
-
In the Start in directory field, enter the full path to your "root" Stalwart Mail folder — the one containing the
standard etc, logs and data sub-folders. That's "C:\Stalwart Mail" on our system.
-
And in the Name field, enter the name that you will call the application in AlwaysUp.
How about Stalwart Mail Server? Otherwise, you can specify another name if you like.
-
Switch to the Logon tab and enter the user name and password of your Windows account.
It's best to run the mail server in an account where you know it works.
-
As you know, Stalwart Mail Server publishes a web console where you can change the program's settings.
You can probably visit it at http://localhost:8080 — the default address.
If you wish to restart the mail server if it ever stops publishing the web console, click over to the Monitor tab.
There, we'll set up a failure detection batch file to tell AlwaysUp when the web console has failed.
-
Follow these instructions to create the failure detection BAT file.
We have called ours check-web-server.bat and placed it in the AlwaysUp folder, C:\Program Files (x86)\AlwaysUp.
-
Click the "..." button in the Whenever it fails a "sanity check" section and specify the full path to the batch file.
Change the Every controls to check every 5 minutes, or tune to any frequency that you see fit.
-
We're done configuring Stalwart Mail Server as a Windows Service so click the Save button to record your settings.
In a couple of seconds, an application named Stalwart Mail Server (or whatever you called it) will show up in the AlwaysUp window.
It is not yet running though so its state will be "Stopped":
-
To start Stalwart Mail Server from AlwaysUp, choose Application > Start "Stalwart Mail Server".
In a few seconds, the status will change to "Running" and Stalwart Mail Server will be chugging away, invisibly in the background:
At this point, please open your favorite browser and check that you can connect to Stalwart Mail Server's web console (http://localhost:8080) normally.
Everything was working well on our machine:
-
That's it! Next time your computer boots, Stalwart Mail Server will start up immediately, in the background, without anyone needing to log on.
Please restart your PC now and test that everything works as expected after Windows returns to life.
And please feel free to edit Stalwart Mail Server in AlwaysUp and explore the many other settings that may be appropriate for your environment.
For example, send an email if Stalwart Mail Server stops, restart it if it uses too much CPU, or recycle it weekly to cure memory leaks.