0

I'm trying to send an email to my aliases in my system. This is how my aliases file look like:

cat aliases
users: user, user1

After I added the aliases I added it to postfix with postalias aliases then I restarted my postfix service and then my dovecot service. I then tried to send an email to my alias with mutt:

 mutt -s "hello from root" users

But the email doesn't get deliver to either user or user1 and I get a email in the mailbox from when I sent the email:

The mail system

: unknown user: "users"

postconf alias_maps alias_database local_recipient_maps
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
local_recipient_maps = proxy:unix:passwd.byname $alias_maps
4
  • The mail system error is correct. See my answer below.
    – Alxs
    Commented Jul 26, 2017 at 20:57
  • please edit your post and add the output of postconf alias_maps alias_database local_recipient_maps
    – cas
    Commented Jul 26, 2017 at 21:25
  • postconf output looks OK (i thought comma separator was required at first, but man 5 postconf indicates that whitespace or comma is OK - my config has commas, and aliases work without a problem here, so that may be worth trying). Can you add the mail.log entries for sending a test message to an alias? (hint: grep for the destination address to get the queue-id, and then grep for the queue-id).
    – cas
    Commented Jul 27, 2017 at 1:28
  • btw, read that man page, search for local_recipient_maps and check the things it mentions: 1. have you change the local delivery agent (MDA) or local transport setting or do you use luser_relay, mailbox_transport, or fallback_transport? 2. have you configured proxymap so that it can access the passwd file. 3. related to that, if you're running postfix chrooted (you probably are unless you've changed the default setup), is the aliases hash db accessible within that chroot? you may need to use proxy for it it too.
    – cas
    Commented Jul 27, 2017 at 1:33

1 Answer 1

1

The problem is the alias must be set for a user that actually exists. The user users doesn't exist. Change the alias to this:

user: user, user1

OR. Add a user named users

Note: the user used for the alias must also be repeated to the right of the colon as shown above if you want the aliased user to get a copy of the emails.

Remember to rerun the newaliases command or postalias /path/to/aliases.

6
  • 1
    @RuiFRibeiro Interesting. I've confirmed this just now and updated my answer.
    – Alxs
    Commented Jul 26, 2017 at 21:15
  • nonsense. a big part of the point of an email alias is that the alias DOESN'T have to exist as a user on the mail server. I have dozens and dozens of aliases on my mail server (each one created for a different web site, mailing list, company, or other organisation that wants an email address for me), none of them exist as a user and all look like alias: cas or alias: cas+alias (to make it easier to process with procmail).
    – cas
    Commented Jul 26, 2017 at 21:22
  • that's not what @Alxs wrote ("OR. Add a user named users"). and it's not true, either. an alias can point to a remote email address, or to another alias. it can also point to a non-existent local user (in which case, will bounce or be rejected). if an alias has multiple recipients, delivery will be attempted to all of them - and if any don't exist, only they will bounce.
    – cas
    Commented Jul 26, 2017 at 21:27
  • I agree with cas, what's the point of the alias then? I mean, if I have an alias: user: user, user1, how can I send the email just to user without sending it to user1?
    – VaTo
    Commented Jul 26, 2017 at 22:41
  • Just so you know, I changed my aliases to user: user1 then I ran postalias restarted the postfix service and when I send the email to user it gets send to user not to user1
    – VaTo
    Commented Jul 26, 2017 at 23:02

You must log in to answer this question.

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