Errors/missing entries with Netcup DNS Management

Issue Description

I set up automaic DNS management for Netcup and it seems to parly work. I can see some DNS entries added but not all.

Expected Behavior

All the DNS records should be added.

Actual Behavior

Only some of the recorords could be added.

Reproduction Steps

  1. Configure DNS management for Netcup with API Key etc.
  2. Open the Netcup customer control panel and look at the DNS records.
  3. You will notice missing entries.
  4. Open the Stalwart WebUI, you will see some Failed Tasks entries (see below)

Relevant Log Output

Failed to create DNS record for _caldavs._tcp.literatur-digital.de.: Failed to create DNS record: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to create DNS record for _carddavs._tcp.literatur-digital.de.: Failed to create DNS record: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to create DNS record for _imaps._tcp.literatur-digital.de.: Failed to create DNS record: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to create DNS record for _jmap._tcp.literatur-digital.de.: Failed to create DNS record: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to create DNS record for _pop3s._tcp.literatur-digital.de.: Failed to create DNS record: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to create DNS record for _submissions._tcp.literatur-digital.de.: Failed to create DNS record: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format.

Stalwart Version

v0.16.x

Installation Method

Docker

Database Backend

PostgreSQL

Blob Storage

PostgreSQL

Search Engine

PostgreSQL

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

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

The source file for records.rs isn’t fetchable directly, but the picture is clear from the error and the code structure. Let me check if there’s a known issue or workaround documented anywhere.

The error code=4013 Destination of SRV entry is in wrong format is coming from Netcup’s API itself, not from Stalwart. This means Stalwart is generating SRV records in a format that Netcup’s DNS API rejects.

Netcup’s SRV record destination field typically requires a specific format: it expects the “destination” to be just the weight, port, and target hostname combined in their own format (e.g. 0 443 mail.example.com.), and some providers are strict about the trailing dot or the structure. This is a compatibility issue between the dns_update library’s Netcup driver and Netcup’s specific SRV record API format - the SRV target field value being sent doesn’t match what Netcup expects.

Looking at the Stalwart source, SRV records are built using SRVRecord { target, priority, ... } from the dns_update crate, which then formats and sends the payload to Netcup’s API. The error is Netcup rejecting the formatted destination string.

What you can do right now:

  • The SRV records that failed are all service-discovery records (_imaps, _pop3s, _submissions, _caldavs, _carddavs, _jmap). Your server is still fully functional without them - these are autodiscovery conveniences, not required for mail delivery or authentication (SPF, DKIM, DMARC, MX, which appear to have worked).
  • You can manually create those SRV records in the Netcup control panel using the values from the Stalwart-generated zone file (visible in the WebUI under your domain’s DNS settings).
  • This appears to be a bug in the Netcup provider integration in Stalwart. Since error handling and format specifics are inside the dns_update crate’s Netcup implementation, a human maintainer will need to investigate the exact SRV destination format Netcup expects vs. what is being sent.

There is no documented workaround in the current docs for this specific Netcup SRV format issue. A staff member will need to follow up on this one.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong. If you found it useful, mention @helpbot in any reply to ask follow-up questions and the bot will respond again.

So should I open a bug report on github or is this thread here enough?

This thread is enough – the Stalwart team monitors this support forum and a staff member will follow up here directly. No need to go anywhere else.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong. If you found it useful, mention @helpbot in any reply to ask follow-up questions and the bot will respond again.

This has been fixed but could not be tested as we do not have an account with your DNS provider. If you are familiar with Rust (or have an LLM to help you) we suggest you try running a quick test using the dns-update crate (with the latest code from main).

Sorry, I wasn’t able to test it beforehand. But with 0.16.7, I get the following errors (and no DNS record could be applied). So it’s less successful than before.

Failed to set DNS RRSet for _imaps._tcp.literatur-digital.de./SRV: Failed to set DNS RRSet: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to set DNS RRSet for _jmap._tcp.literatur-digital.de./SRV: Failed to set DNS RRSet: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to set DNS RRSet for _caldavs._tcp.literatur-digital.de./SRV: Failed to set DNS RRSet: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to set DNS RRSet for _carddavs._tcp.literatur-digital.de./SRV: Failed to set DNS RRSet: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to set DNS RRSet for _pop3s._tcp.literatur-digital.de./SRV: Failed to set DNS RRSet: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format. ; Failed to set DNS RRSet for _submissions._tcp.literatur-digital.de./SRV: Failed to set DNS RRSet: API error: Netcup API error: status=error code=4013 short=Validation Error. long=Destination of SRV entry is in wrong format.

Unfortunately we’ll have to wait until someone contributes a fix as there are over 60 providers and we don’t have API keys to test all of them.

If there were detailed instructions, I would be happy to run some tests.

@mdecimus I guess I found the bug for SRV records in the dns-update crate:

diff --git a/src/providers/netcup.rs b/src/providers/netcup.rs
index e1c40a6..826e789 100644
--- a/src/providers/netcup.rs
+++ b/src/providers/netcup.rs
@@ -484,7 +484,8 @@ fn encode_record(record: &DnsRecord, hostname: &str) -> crate::Result<NetcupReco
         DnsRecord::SRV(srv) => (
             "SRV",
             format!(
-                "{} {} {}",
+                "{} {} {} {}",
+                srv.priority,
                 srv.weight,
                 srv.port,
                 ensure_trailing_dot(&srv.target),

I filed a PR, see fix SRV record for netcup provider · Pull Request #64 · stalwartlabs/dns-update