I have configured a basic Postfix setup to send mail using an external smtp relayhost, and resolving locally address mail via /etc/aliases
. Sending email works (via the sendmail
command)
However, when I receive the mail, the To:
header is missing; it doesn't show up in the raw email message.
Question: How can I have the To:
header show up in the receiving mail?
More details
For example, when I send this from the command line:
echo -e "Subject: test no header\n\nBody message" | sendmail myprivate@email.com
or
echo -e "Subject: test no header\n\nBody message" | sendmail root
with /etc/aliases
having a line root: myprivate@email.com
I receive the email in both cases. But in both cases, the To:
header is not there.
The raw mail looks like this:
Return-Path: <root@myhost.mydomain.com>
X-Envelope-To: myprivate@email.com
X-Footer: aW5kaWdvbWVkLmNvbQ==
Received: from .....
Received: by ...
Delivered-To: root@myhost.mydomain.com
Received: by myhost.mydomain.com (Postfix, from userid 0)
id 70CD8A03; Tue, 12 Jan 2021 14:48:16 +0100 (CET)
Subject: test no header
Message-Id: <20210112134816.70CD8A03@myhost.mydomain.com>
Date: Tue, 12 Jan 2021 14:48:16 +0100 (CET)
From: root <root@myhost.mydomain.com>
Body message
What I already tried:
Sending the mail via
mailx
DOES insert the To: header, e.g.echo -e "Body message" | mailx root -s "Subject: test no header"
I already tried configuring
always_add_missing_headers = yes
in/etc/postfix/main.cf
but it doesn't help.
Some relevant parts (I think) from my /etc/postfix/main.cf
file:
...
append_dot_mydomain = no
...
# General
myhostname = myhost.mydomain.com
myorigin = myhost.mydomain.com
mydestination = $myhostname localhost.$mydomain localhost myhost
...
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
....
relayhost = mail.something.com:465