SMTP submission listener on port 587 is not starting in Stalwart v0.16.15 (Gitea integration issue)

Issue Description

Gitea SMTP connection to Stalwart on port 587 fails - submission listener issue

Hello,

I am running Stalwart Mail Server v0.16.15 on Windows and trying to use it as an SMTP server for Gitea.

My setup:

  • OS: Windows
  • Stalwart version: 0.16.15
  • Gitea version: development built with Go 1.26.5

The Stalwart setup was completed successfully and the WebUI is working.

I configured Gitea to send emails through Stalwart using SMTP submission on port 587:

[mailer]
ENABLED = true
PROTOCOL = smtp+starttls
SMTP_ADDR = 127.0.0.1
SMTP_PORT = 587
FROM = [email protected]
USER = [email protected]
PASSWD = ********

However, Gitea cannot connect to the SMTP server:

failed to establish network connection to SMTP server:
dial tcp 127.0.0.1:587:
connectex: No connection could be made because the target machine actively refused it

Testing the port:

Test-NetConnection 127.0.0.1 -Port 587

returns:

TcpTestSucceeded : False

The default SMTP listener on port 25 is working:

TCP [::]:25 LISTENING

but after creating a listener for port 587 in the Stalwart WebUI, it appears in the interface but no TCP listener is created:

netstat -ano | findstr LISTENING | findstr :587

returns no result.

I would like to know whether this is expected behavior or if there is an additional configuration step required for SMTP submission on port 587.

I have already checked the documentation and verified my configuration, but I could not find information about why the listener appears in the WebUI but does not bind to the TCP port.

Expected Behavior

After creating and enabling an SMTP submission listener on port 587 from the Stalwart WebUI, I expect Stalwart to bind and listen on that TCP port.

The expected behavior is:

  • The listener should become active after saving the configuration (or after the required reload/restart step).
  • netstat should show Stalwart listening on port 587.
  • Gitea should be able to establish an SMTP connection using:
PROTOCOL = smtp+starttls
SMTP_ADDR = 127.0.0.1
SMTP_PORT = 587

I expect port 587 to work as a standard SMTP submission service with STARTTLS support, similar to the default SMTP listener on port 25 but intended for authenticated client submission.

If an additional configuration step, restart, certificate setup, or different listener type is required for port 587, I would expect this to be documented or indicated in the WebUI.

Actual Behavior

After creating and enabling an SMTP listener for port 587 in the Stalwart WebUI, the listener appears in the WebUI configuration page, but Stalwart does not actually open or bind the TCP port.

The listener is visible at:

http://[::1]:8080/account/Settings/x:NetworkListener

However, checking the active TCP listeners shows no service running on port 587:

netstat -ano | findstr LISTENING | findstr :587

Output:

(no result)

As a result, Gitea cannot connect to Stalwart using SMTP submission on port 587 and returns:

failed to establish network connection to SMTP server:
dial tcp 127.0.0.1:587:
connectex: No connection could be made because the target machine actively refused it

The default SMTP listener on port 25 works correctly:

netstat -ano | findstr :25

Output:

TCP    [::]:25    [::]:0    LISTENING

The difference is that the port 587 listener is saved and displayed in the WebUI but does not appear to become an active TCP listener.

Reproduction Steps

Reproduction Steps

  1. Install Stalwart Mail Server v0.16.15 on Windows.

  2. Complete the initial setup through the Stalwart WebUI.

  3. Open the Network Listener configuration page:

http://[::1]:8080/account/Settings/x:NetworkListener
  1. Create a new SMTP submission listener with port 587.

  2. Enable the listener and save the configuration.

  3. Restart Stalwart if required.

  4. Check whether Stalwart is listening on port 587:

netstat -ano | findstr LISTENING | findstr :587
  1. Observe that no TCP listener is shown for port 587.

  2. Test the port connection:

Test-NetConnection 127.0.0.1 -Port 587

Expected result:

TcpTestSucceeded : True

Actual result:

TcpTestSucceeded : False
  1. Configure Gitea SMTP settings to use Stalwart on port 587:
[mailer]
ENABLED = true
PROTOCOL = smtp+starttls
SMTP_ADDR = 127.0.0.1
SMTP_PORT = 587
FROM = [email protected]
USER = [email protected]
PASSWD = ********
  1. Try sending a test email from Gitea.

  2. Observe that Gitea fails to connect because the SMTP server is not accepting connections on port 587.

Relevant Log Output

Stalwart starts successfully and the default SMTP listener on port 25 is active:

2026-07-31T12:56:29Z INFO Application resource updated (resource.application-updated) url = "https://github.com/stalwartlabs/webui/releases/latest/download/webui.zip"
2026-07-31T12:56:29Z INFO Network listener started (network.listen-start) listenerId = "http-recovery", localIp = ::, localPort = 8080, tls = false

The SMTP listener on port 25 is visible and active:

TCP    [::]:25    [::]:0    LISTENING

However, after creating the port 587 listener from the WebUI, there is no corresponding listener start message in the logs and no TCP port is opened:

netstat -ano | findstr LISTENING | findstr :587

Output:

(no result)

Testing the connection from Windows:

Test-NetConnection 127.0.0.1 -Port 587

Output:

TcpTestSucceeded : False

When Gitea attempts to send a test email, the error is:

Failed to send a testing email:
failed to establish network connection to SMTP server:
dial tcp 127.0.0.1:587:
connectex: No connection could be made because the target machine actively refused it

No additional Stalwart error is shown when creating the listener; the listener only appears in the WebUI but does not seem to start at the TCP level.

After adding the listener, restarting Stalwart does not produce any:
network.listen-start
message for port 587.

Stalwart Version

v0.16.x

Installation Method

Binary (Windows)

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

Additional observation

While troubleshooting, I noticed another behavior that may be related.

The Stalwart WebUI is reachable using the IPv6 loopback address:

http://[::1]:8080/account/Settings/x:NetworkListener

However, the same page is not reachable using the IPv4 loopback address:

http://127.0.0.1:8080/account/Settings/x:NetworkListener

This suggests that the HTTP listener is accepting connections on IPv6 but not on IPv4.

Because Gitea is configured to connect to:

SMTP_ADDR = 127.0.0.1
SMTP_PORT = 587

I am wondering whether the SMTP listener behavior is also affected by IPv4 vs IPv6 binding.

Is this expected behavior on Windows, or should Stalwart normally listen on both IPv4 and IPv6 by default?

Fixed in v0.16.16 (yet to be released). This was a problem that only affected Windows which binds [::] to IPv6 only.