Send from third-level domain to second-level

after my unanswered email some days ago I tried to read the manual and I did some experiments, but I still cannot find a solution.

I have both a 2nd level domain and a 3rd level domain, where the 3rd level corresponds to my home network but has no emails associated with it. All my email addresses are associated to the 2nd level.

My goal is:
- from command line to fully specified email addresses: send normally
- from command line to local users, without any domain: send to " ... at marzocchi dot net"
- from command line to root user: send to " ... at marzocchi dot net" (so that I can read error notifications when not at home)
- sender domain should appear to be the 3rd level domain.

mydomain =
myorigin = $mydomain
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
relayhost = …

root: <a href="mailto: ... at marzocchi dot net"> ... at marzocchi dot net</a>

then I run:
/usr/local/sbin/postalias hash:/etc/postfix/aliases

Sending to fully specified email addresses works.
However, sending to local users without specifying any domain, doesn’t:
$ mailx -s “test” root

And the email is lost.
This shows that, somehow, the address is not rewritten as I specified in aliases.
Also, the same happens if I send to a local user.
Basically, if the email address is not fully specified, the only thing that happens is that my (3rd level) domain gets appended and nothing more.

I surely made a mistake, but which one?
Or maybe I am approaching the problem from the wrong point of view and there is a simpler way?

Can anyone help me?



Re: Send from third-level domain to second-level

By Wietse Venema at 02/08/2014 - 21:19

Olaf Marzocchi:
Sorry, Postfix is consistent. If the sender or recipient address
has no domain, then it appends $myorigin, as documented in:

<a href="" title=""></a>

To deliver some recipients locally, see:

<a href="" title=""></a>


Re: Send from third-level domain to second-level

By Olaf Marzocchi at 02/09/2014 - 07:39

Hi, actually the suggestion helped :)
I didn’t notice the section:
<a href="" title=""></a>
that pointed me in the right direction.
By leaving mydestination blank and by setting myorigin to my 2nd level, I can use /etc/postfix/virtual to redirect only root, while getting mail for the other users automatically delivered to the external mailboxes.
Or, if I still want to see when a mail is originated from the server and not from a normal mail client, I can set myorigin to the 3rd level and manually (not very beautifully) enter the replacements in /etc/postfix/virtual, so that the sender appears to be user@3rd-level but they are still delivered to user@2nd-level.


Il giorno 09/feb/2014, alle ore 02:19, Wietse Venema < ... at porcupine dot org> ha scritto: