Sender and Reply-To¶
The envelope sender, From, Sender and Reply-To serve different purposes.
Setup¶
Prepare your values and Debian packages. CLI tests use only your local test files and configuration.
Set From to the actual author. Use Sender when sending on another author's behalf and choose Reply-To deliberately. Protect differing Reply-To values through DKIM oversigning. Prepare the sample message.
Test¶
set -euo pipefail
. /root/mailserver.env
python3 - <<'PY'
from email.parser import BytesParser
from email.policy import default
from email.utils import getaddresses, parsedate_to_datetime
from pathlib import Path
import os, re
raw = Path("/root/mail-tests/sample.eml").read_bytes()
message = BytesParser(policy=default).parsebytes(raw)
authors = getaddresses(message.get_all("From", []))
assert len(authors) == 1 and authors[0][1] == os.environ["MAILBOX"]
print("From:", authors[0][1])
print("Sender:", message.get("Sender", "(not set)"))
print("Reply-To:", message.get("Reply-To", "(not set)"))
print("PASS: a single expected author is present; review any differences carefully.")
PY
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.