1

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

postmaster:    root
root:   [email protected]

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:

[email protected]    [email protected]
[email protected]    [email protected]
[email protected] [email protected]

(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: [email protected]
Return-Path: <[email protected]>
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 <[email protected]>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 09 Jan 2016 09:00:25 -0800 (PST)
From: Scott Hamilton <[email protected]>
X-Google-Original-From: [email protected] (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: <[email protected]>
X-Mailer: mail (GNU Mailutils 2.99.98)
Message-Id: <[email protected]>
Date: Sat,  9 Jan 2016 12:01:02 -0500 (EST)

test

1 Answer 1

1

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:

[email protected] [email protected]

after saving execute the command sudo service postfix reload

(See also: here)

3
  • Thanks - and thanks for the link as it informed me of the need to run postmap as an additional step. I updated my original post with more details as this is still not quite functioning how I'd like. I also thought maybe I needed to remove the /etc/aliases and root/.forward attempts I had made but these made no difference when I removed them and restarted postfix (and ran newaliases).
    – Scott
    Jan 9, 2016 at 17:18
  • You're welcome. When a solution provides you with a correct answer you can confirm this by clicked the accept button so others can quickly see the answer worked for the questioner. see also: askubuntu.com/help/someone-answers
    – Requist
    Jan 9, 2016 at 17:31
  • Well, it's not quite resolved/answered yet. :) I'm still trying to get the emails set without the BCC directly to the gmail account.
    – Scott
    Jan 9, 2016 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .