On 2023-11-28, I received notice from my email provider that, very shortly, they would not relay mail for domains other than the one(s) you had purchased. This meant I could no longer use their email server as a smarthoste for the hydrus.org.uk domain.
I also had access to my ISP's (Plusnet) email servers but had never used them. Was it possible to use to Plusnet's servers as a of smarthost? A web search indicated that people were indeed making use Plusnet's servers in that fashion. I therefore changed the EXIM configuration on ash to see if I could get it to work.
Plusnet documentation said that no authentication was necessary if access was from a Plusnet IP address, so that was one thing I didn't need to configure.
My first attempt was a failure:
2024-01-10 16:35:12 1rNbXr-0007o2-0k => xx@gmail.com R=smarthost T=remote_smtp_smarthost H=relay.plus.net [212.159.9.107] X=TLS1.2:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256 CV=yes DN="C=GB,L=Sheffield,O=Plusnet plc,CN=relay.plus.net" C="250 NbXrrDVo26TVUNbXsr7oO5 mail accepted for delivery" 2024-01-10 16:35:12 1rNbXr-0007o2-0k Completed 2024-01-10 16:35:13 1rNbXt-0007o6-1Y rewrite: missing or malformed local part 2024-01-10 16:35:13 1rNbXt-0007o6-1Y H=avasout-ptp-002.plus.net [84.93.230.235] X=TLS1.2:ECDHE_X25519__ECDSA_SHA256__AES_256_GCM:256 CV=no F=<> rejected after DATA: header syntax (missing or malformed local part: failing address in "From:" header is: <>)
Hmm, what was the cause of this? After some reading around, I noticed this comment in this Debian wiki entry:
6. The SMTP server may reject mail without a proper "From:"
address. Add a line to /etc/email-addresses
to link
each linux user to an email address e.g.
root:sysadmin@example.org
Creating this file with the appropriate user/email mapping worked!
There is another solution that avoids creating the
/etc/mail-addresses
file: that is, add another rewrite rule to the
REMOTE_SMTP_HEADERS_REWRITE macro in
/etc/exim4/exim4.conf.localmacros
:
REMOTE_SMTP_HEADERS_REWRITE = *@*.hydrus.org.uk $1@hydrus.org.uk f : \ !*@* $0@hydrus.org.uk f
I also had to update the SPF TXT record in the DNS for hydrus.org.uk to let Google (and others?) know that plus.net was a valid relay.
"v=spf1 include:plus.net ~all"