M HYPE SPLASH
// general

Emails to root go to root@localhost and BCC my aliased address

By John Campbell

I've configured postfix to send through my gmail account. My /etc/aliases looks like this:

postmaster: root
root: 

When I test this using the following:

echo test | mail -s "test message" root

I receive the email in my gmail account as sent to root@localhost with my gmail account BCC'd.

I'd like to have it sent directly to my gmail account and not to the root@localhost.

What am I missing?

Thanks!

UPDATE

Applying the suggested virtual mapping I can see the effects at the BCC level but it is still BCC'ing rather than sending root email directly to the intended email address.

The main.cf change made is:

virtual_alias_domains = uberserver uberserver.home my-registered-domain.net
virtual_alias_maps = hash:/etc/postfix/virtual

And the /etc/postfix/virtual change:

(I did this so that I could see different gmail recipients depending on the recipient postfix originally saw.)

Note that I also had to run postmap... then I re-ran the test.

Here's an example of the test email received in gmail:

Bcc:
Return-Path: <>
Received: from uberserver.home (pool-xxx-xx-xxx-xx.someplace.fios.verizon.net. [xxx.xx.xxx.xx]) by smtp.gmail.com with ESMTPSA id v78sm25438329qge.25.2016.01.09.09.00.25 for <> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Jan 2016 09:00:25 -0800 (PST)
From: Scott Hamilton <>
X-Google-Original-From: (Scott Hamilton)
Received: by uberserver.home (Postfix, from userid 1000) id A47B44809C5; Sat, 9 Jan 2016 12:01:02 -0500 (EST)
Subject: test message
To: <>
X-Mailer: mail (GNU Mailutils 2.99.98)
Message-Id: <>
Date: Sat, 9 Jan 2016 12:01:02 -0500 (EST)
test

1 Answer

The method you describe is merely used for aliasing non existing mailboxes, I do not know if this behavior can be tweaked to do it differently.
However you can accomplish what you want by editing /etc/postfix/main.cf and adding two lines:

virtual_alias_domains = mydomain.com myanotherdomain.com
virtual_alias_maps = hash:/etc/postfix/virtual

then edit (or create) /etc/postfix/virtual and add:

after saving execute the command sudo service postfix reload

(See also: here)

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy