Install Stalwart Mail Server as a Windows Service with AlwaysUp

How to Install & Run Stalwart Mail Server as a Windows Service with AlwaysUp

Automatically start Stalwart Mail Server in the background whenever your computer reboots and keep it running 24/7. No need to log in first

Stalwart Mail Server offers a modern, scalable way to handle your own email.

To setup Stalwart Mail Server as a Windows Service with AlwaysUp:

  1. 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:

    Stalwart Mail Server installed and running in the web browser

    Log in and make sure everything looks good.

  2. Next, download and install AlwaysUp, if necessary.

  3. Start AlwaysUp.

  4. Select Application > Add to open the Add Application window:

    Add Application

  5. 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.

    Stalwart Mail Server Windows Service: General Tab

  6. 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.

    Stalwart Mail Server Windows Service: Logon Tab

  7. 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.

    1. 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.

    2. 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.

    Stalwart Mail Server Windows Service: Monitor Tab

  8. 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":

    Stalwart Mail Server Windows Service: Installed

  9. 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:

    Stalwart Mail Server Windows Service: Running

    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:

    Stalwart Mail Server Windows Service: Check the web console

  10. 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.



Stalwart Mail Server not working properly as a Windows Service?

  • Consult the AlwaysUp Troubleshooter — our online tool that can help you resolve the most common problems encountered when running an application as a Windows Service.

  • From AlwaysUp, select Application > Report Activity > Today to bring up an HTML report detailing the interaction between AlwaysUp and Stalwart Mail Server. The AlwaysUp Event Log Messages page explains the messages that may appear.

  • Browse the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.

  • Contact us and we'll be happy to help!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 15.1

7.9 MB Installer
Our 12,000+ customers include...
Compatible with Windows 11 Compatible with Windows Server 2022 Compatible with Windows 10
Over 94,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 19+ years!