Stalwart aims to automate all DNS records associated with mail delivery/receipt and it does this very well. One thing missing though, is the ability to create a custom SPF record.
If the administrator requires a custom SPF, then they must stop Stalwart from generating the SPF record for a domain and manually create it themselves.
I would like to have the option of associating a custom SPF mechanisms to a domain.
I propose a single field on the ‘Edit domain’ page, ‘Additional SPF mechanisms’. The field would accept one or more bare SPF mechanisms - For example:
ip4:198.51.100.0/24 include:_spf.mailgun.org include:_spf.eu.mailgun.org
which Stalwart would splice into the generated record immediately before the terminating all, producing something like
v=spf1 mx ip4:198.51.100.0/24 include:_spf.mailgun.org include:_spf.eu.mailgun.org -all.
On save, the field could be validated to reject a v=spf1 prefix or any ‘all’ mechanism, since both are supplied by Stalwart. Ideally the field would be offered separately for the domain and the mail host identities, as Stalwart generates an SPF record for each.