1

Topic: all aliases ignore ?

==== Provide basic information to help troubleshoot ====
- iRedMail version: 0.7.3
- Linux/BSD distribution name and version: opensuse 11.4
====

1. i create an user (lalalu) in ired-admin-pro
  - works fine, i can send mail to lalalu@...
2. i add an alias in /etc/aliases
  - la123: lalalu
  - call newaliases
  - don't work
3. i add an alias in /etc/postfix/aliases
  - la123: lalalu
  - call newaliases
  - don't work

found in main.cf the follow line
  alias_maps = hash:/etc/postfix/aliases

hmm => Recipient address rejected: User unknown in virtual mailbox table ...

why ???

2

Re: all aliases ignore ?

foobar wrote:

3. i add an alias in /etc/postfix/aliases
  - la123: lalalu
  - call newaliases
  - don't work

How did you create this alias?

Since you have "alias_maps = hash:/etc/postfix/aliases" in Postfix, it should work fine. so please post file content to help troubleshoot.

3 (edited by foobar 2011-10-17 14:48:56)

Re: all aliases ignore ?

ZhangHuangbin wrote:
foobar wrote:

3. i add an alias in /etc/postfix/aliases
  - la123: lalalu
  - call newaliases
  - don't work

How did you create this alias?

Since you have "alias_maps = hash:/etc/postfix/aliases" in Postfix, it should work fine. so please post file content to help troubleshoot.

which file content ?

the entry in /etc/postfix/aliases is very simple
la123:  lalalu

$> postconf -n | grep alias
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
newaliases_path = /usr/bin/newaliases
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf, proxy:mysql:/etc/postfix/mysql/catchall_maps.cf, proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf

4

Re: all aliases ignore ?

foobar wrote:

the entry in /etc/postfix/aliases is very simple
la123:  lalalu

With this entry, Postfix will know user "la123@[YOUR_SERVER_HOSTNAME]".

My personal suggestion is, why not just create one with iRedAdmin-Pro? It's easier and simpler.

5

Re: all aliases ignore ?

ZhangHuangbin wrote:
foobar wrote:

the entry in /etc/postfix/aliases is very simple
la123:  lalalu

With this entry, Postfix will know user "la123@[YOUR_SERVER_HOSTNAME]".

My personal suggestion is, why not just create one with iRedAdmin-Pro? It's easier and simpler.

no, the alias-file is need for the follow wink

lala01: "| /usr/bin/mlmmj-recieve -L /var/spool/mlmmj/lala01"

6

Re: all aliases ignore ?

I am also having this problem:

# postconf -n | grep alias
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
# cat /etc/postfix/aliases
apache: root
root: www@mydomain.com
policyd: root
user1nuser2: user1@mydomain.com,user2@mydomain.com
spam: user1@mydomain.com
register: user1@mydomain.com
order: user1@mydomain.com

I run newaliases, and then try to send a mail:

Jun  8 02:56:57 server postfix/smtpd[31047]: NOQUEUE: reject: RCPT from unknown[xx.xx.xx.xx]: 550 5.1.1 <spam@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<user1@mydomain.com> to=<spam@mydomain.coms> proto=ESMTP helo=<[192.168.x.x]>
Jun  8 02:56:57 server postfix/smtpd[31047]: 979F8B90255: client=unknown[xx.xx.xx.xx], sasl_method=PLAIN, sasl_username=user1@mydomain.com
Jun  8 02:56:57 server postfix/smtpd[31047]: 979F8B90255: reject: RCPT from unknown[xx.xx.xx.xx]: 550 5.1.1 <junk@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<user1@mydomain.com> to=<junk@mydomain.com> proto=ESMTP helo=<[192.168.x.x]>
Jun  8 02:56:58 server postfix/smtpd[31047]: 979F8B90255: reject: RCPT from unknown[xx.xx.xx.xx]: 550 5.1.1 <register@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<user1@mydomain.com> to=<register@mydomain.com> proto=ESMTP helo=<[192.168.x.x]>

I have hundreds and hundreds of aliases in this format, and frankly maintaining a simple text file is far less cumbersome than maintaining an LDAP database.  Does this actually work with iRedMail?  And if so, what step am I missing?

Thanks!

7

Re: all aliases ignore ?

Dear tedcox,

You have to make sure 'user1@mydomain.com' exist on your mail server first.

8 (edited by tedcox 2012-06-08 23:30:26)

Re: all aliases ignore ?

ZhangHuangbin wrote:

Dear tedcox,

You have to make sure 'user1@mydomain.com' exist on your mail server first.


Thanks for the swift reply.  All of the users I'm trying to alias do exist as mail accounts.  Are you saying they need to be system accounts?  And if so, how do I connect system and mail accounts?

9

Re: all aliases ignore ?

tedcox wrote:

All of the users I'm trying to alias do exist as mail accounts. Are you saying they need to be system accounts?

No, they must be valid mail accounts. For example, you can mail them directly with the email addresses.

May i know how you sent email which causes this error message? Show us the sender/recipient  email addresses, and tell us which mail client you used. e.g. Thunderbird, Outlook.

10 (edited by tedcox 2012-06-11 21:49:50)

Re: all aliases ignore ?

Here's an example sent through gmail to an alias (spam@mydomain.com):

Jun  9 04:58:54 daniel postfix/smtpd[12892]: NOQUEUE: reject: RCPT from unknown[xx.xx.xx.xx]: 550 5.1.1 <spam@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<ted.cox@mywork.org> to=<spam@mydomain.com> proto=ESMTP helo=<mail-gh0-f169.google.com>

Here's another example sent through Apple Mail to the same alias:

Jun  9 05:03:47 daniel postfix/smtpd[12968]: NOQUEUE: reject: RCPT from unknown[xx.xx.xx.xx]: 550 5.1.1 <spam@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<ted@mydomain.com> to=<spam@mydomain.com> proto=ESMTP helo=<[192.168.7.139]>

Does that help?

EDIT: Here's another example from Apple Mail on the same machine sent to the address the alias is directed to (ted@mydomain.com), which completes successfully:

Jun  9 05:22:27 daniel postfix/smtpd[13103]: 1E664B90255: client=unknown[xx.xx.xx.xx], sasl_method=PLAIN, sasl_username=ted@mydomain.com
Jun  9 05:22:27 daniel postfix/cleanup[13107]: 1E664B90255: message-id=<3455F2D2-B89D-4695-B8A7-ACC1B38B7FA3@mydomain.com>
Jun  9 05:22:27 daniel postfix/qmgr[20633]: 1E664B90255: from=<ted@mydomain.com>, size=517, nrcpt=1 (queue active)
Jun  9 05:22:27 daniel postfix/smtpd[13110]: connect from localhost.localdomain[127.0.0.1]
Jun  9 05:22:27 daniel postfix/smtpd[13110]: F1F94B9029D: client=localhost.localdomain[127.0.0.1]
Jun  9 05:22:27 daniel postfix/cleanup[13107]: F1F94B9029D: message-id=<3455F2D2-B89D-4695-B8A7-ACC1B38B7FA3@mydomain.com>
Jun  9 05:22:28 daniel postfix/qmgr[20633]: F1F94B9029D: from=<ted@mydomain.com>, size=1477, nrcpt=1 (queue active)
Jun  9 05:22:28 daniel postfix/smtpd[13110]: disconnect from localhost.localdomain[127.0.0.1]
Jun  9 05:22:28 daniel amavis[11622]: (11622-02) Passed CLEAN, MYUSERS LOCAL [xx.xx.xx.xx] [xx.xx.xx.xx] <ted@mydomain.com> -> <ted@mydomain.com>, Message-ID: <3455F2D2-B89D-4695-B8A7-ACC1B38B7FA3@mydomain.com>, mail_id: HFQSkE7RkgtH, Hits: -10, size: 517, queued_as: F1F94B9029D, 428 ms
Jun  9 05:22:28 daniel postfix/smtp[13108]: 1E664B90255: to=<ted@mydomain.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=1.2, delays=0.67/0.01/0/0.48, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=11622-02, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as F1F94B9029D)
Jun  9 05:22:28 daniel postfix/qmgr[20633]: 1E664B90255: removed
Jun  9 05:22:28 daniel postfix/pipe[13111]: F1F94B9029D: to=<ted@mydomain.com>, relay=dovecot, delay=0.18, delays=0.02/0.01/0/0.15, dsn=2.0.0, status=sent (delivered via dovecot service)

11

Re: all aliases ignore ?

bump

12

Re: all aliases ignore ?

tedcox wrote:

spam: user1@mydomain.com

With this alias in /etc/postfix/aliases, the real email address is: spam@[YOUR_SERVER_HOSTNAME], not spam@mydomain.com.

You can get server hostname with command 'hostname -f'. For example, if your server hostname is 'server.mydomain.com', then this alias means: spam@server.mydomain.com -> user1@mydomain.com.

Hope it's clear now.

13

Re: all aliases ignore ?

ZhangHuangbin wrote:
tedcox wrote:

spam: user1@mydomain.com

With this alias in /etc/postfix/aliases, the real email address is: spam@[YOUR_SERVER_HOSTNAME], not spam@mydomain.com.

You can get server hostname with command 'hostname -f'. For example, if your server hostname is 'server.mydomain.com', then this alias means: spam@server.mydomain.com -> user1@mydomain.com.

Hope it's clear now.

Yes.  I understand the problem now.  Thanks.  This was easy to make work in sendmail, however.  Is there also a way to resolve it here?  It looks to me, like I could configure the virtual_mailbox_domains parameter in postfix, and creating a table in /etc/postfix/virtual, however, I don't want to unravel the way iredmail is functioning with postfix.

Or is there a simple way to convert a text file of aliases into aliases in the LDAP database?

14

Re: all aliases ignore ?

How about create a new mail user 'spam@mydomain.com' in LDAP, then forward all mails to user1@?

With iRedAdmin-Pro-LDAP, it's easy to config forwarding addresses for a mail user. Steps:

1: Login to iRedAdmin (open source edition): httpS://your_server/iredadmin/
2: Create a new mail user 'spam@mydomain.com'. It will redirect you to user profile page of spam@ after account successfully created.
3: In user profile page, click tab 'Forwarding'. Add 'user1@mydomain.com' (without quotes) as forwarding address. Save changes. iRedAdmin will check whether account 'user1@mydomain.com' exist on server, and discard it if not existing.

That's all. Screenshot for your reference:

http://iredmail.org/images/iredadmin/user_profile_mail_forwarding.png

But you didn't mention you have iRedAdmin-Pro-LDAP installed, so i guess you're running iRedAdmin open source edition. That's fine, you can easily achieve this with below steps:

1: Login to iRedAdmin (open source edition): httpS://your_server/iredadmin/
2: Create a new mail user 'spam@mydomain.com'
3: Login to phpLDAPadmin: httpS://your_server/phpldapadmin/
4: in phpLDAPadmin, Make sure user 'spam@' has below attribute/value:

accountStatus: active
enabledService: deliver
enabledService: forward

5: Add new attribute mailForwardingAddress, input 'user1@mydomain.com' (without quotes, of course) as its value. Save changes.

That's all.

You can verify the forwarding with below command, it should output 'user1@mydomain.com':

# postmap -q 'spam@mydomain.com' ldap:/etc/postfix/ldap/virtual_alias_maps.cf
user1@mydomain.com

Hope it helps.

Note: You can assign multiple email addresses as forwarding addresses. smile

15

Re: all aliases ignore ?

ZhangHuangbin,

Thanks so much for your responsiveness and help.  I'm actually looking for a solution to handle a bulk list of aliased users, so multiple steps for each user is a bit much.  After some research, though, I think I should be able to write a script to convert the entries in my old aliases file into LDIF format and import them into the LDAP database.

Again, thanks for the help.  You've created a very impressive product here, and your support is top notch!
Ted

16 (edited by tedcox 2012-06-15 22:25:26)

Re: all aliases ignore ?

In case anyone else needs this, here is my script.  It's not elegant, and is really just tailored to my need.  Note it will not properly handle a 2 user alias.  Example:

thesmiths: sue, bob

It also assumes that your top level LDAP domain and your mail domain are the same.

I'm sure there are lots of other cases where it will also break.  Use caution.  Maybe some fine soul who actually knows what they're doing will come along and improve it.

#!/bin/bash
#
# Simple script to convert files in /etc/aliases to LDIF format
# for import into iRedMail.
#
# ///// WARNING: //////
# 
# /etc/aliases often contains useless entries you do not want in
# you LDAP database.  Make a copy of your /etc/aliases folder,
# place it in a new folder with this script, and delete all the
# aliases you do not want added to your LDAP database.

ALIASFILE="aliases"

cat $ALIASFILE | awk -F':' 'BEGIN{

DOMAIN="mydomain"
TLD="com"
x=1;
}

{
print "# Entry", x ": mail=" $1 "@" DOMAIN "." TLD ",ou=Aliases,domainName=" DOMAIN "." TLD ",o=do...";
print "dn: mail=" $1 "@" DOMAIN "." TLD ",ou=Aliases,domainName=" DOMAIN "." TLD ",o=domains,dc=" DOMAIN ",dc=" TLD;
print "accountstatus: active";
print "cn:" $2, $1  " alias";
print "enabledservice: mail";
print "enabledservice: deliver";
print "mail: " $1 "@" DOMAIN "." TLD;
print "mailforwardingaddress: " $2 "@" DOMAIN "." TLD;
print "objectclass: mailAlias";
print "objectclass: top";
print "";
x++;

}'

17

Re: all aliases ignore ?

Dear tedcox,

You can forward email to multiple users by adding multiple "mailForwardingAddress". For example:

mailForwardingAddress: user1@domain.ltd
mailForwardingAddress: user2@domain.ltd