Check HTML link targets¶
Visible link text and the href target may differ. A mailserver can scan this content; it does not establish domain identity.
Setup¶
Prepare your values and Debian packages. CLI tests use only your local test files and configuration.
Enable Rspamd and generate HTML mail with consistent link text. The following test deliberately creates a contradictory synthetic message and scans it locally.
Test¶
set -euo pipefail
. /root/mailserver.env
python3 - <<'PY'
from email.message import EmailMessage
from email.policy import SMTP
from pathlib import Path
import os
message = EmailMessage()
message["From"] = os.environ["MAILBOX"]
message["To"] = os.environ["MAILBOX"]
message["Subject"] = "Local HTML link test"
message.set_content('<a href="https://target.example.invalid/">https://shown.example.invalid/</a>', subtype="html")
Path("/root/mail-tests/links.eml").write_bytes(message.as_bytes(policy=SMTP))
PY
rspamc -h 127.0.0.1:11333 --json /root/mail-tests/links.eml > /root/mail-tests/links.json
jq -e '.symbols | type == "object"' /root/mail-tests/links.json
jq '{action, score, symbols}' /root/mail-tests/links.json
This CLI test confirms the local behavior described above. For production, send your own message using the actual client and MTA through the real sending route and verify it at a recipient you control.