1 (edited by jpforte 2015-02-27 01:59:49)

Topic: I would like to have non list aliases in the alias lists

============ Required information ====
- iRedMail version: 1.9.1
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: CENTOS 6
- Related log if you're reporting an issue:
====

I have many aliases where I do NOT want the to appear in a list to pick from and I have islets = 0 for the alias.

Creating a user account for a non users just does not seem right. Examples are the default email addresses that need to be sent somewhere but EVERY domain would need to have them setup, root, postmaster, webmaster, abuse etc. OR common misspellings of names that should not be in a list, like zhang@example.com will need hang@example.com, zeehang@example.com, zedhang@example.com, zang@example.com, z.hang@example.com just to keep all us English speakers from sending the email to the wrong address and I DO NOT want those to appear in the pick lists when making users and aliases.

How can I get the alias only accounts that are not part of a list to display and be editable.

Here is how I get the list and only these non list aliases.

mysql vmail -e "select username,address,islist from alias A left JOIN mailbox M ON M.username = A.address WHERE islist = '0' and username IS NULL "

I would be happy to pay for this modification as I have to go to the command line to manage this right now.


Here is a quick and dirty way to spit out some HTML to be able to edit but not add the existing nonlist aliases.

TMPFILE="/tmp/nonalias-$$.tmp"
HTMLFILE="/var/www/html/nonlistaliaes.html"
     SQL="select address,goto
     FROM alias A LEFT JOIN mailbox M ON M.username = A.address
     WHERE islist = '0' and username IS NULL "
     mysql vmail -e "$SQL" > $TMPFILE
     awk 'BEGIN { print "<table>"}
     {if ( NR == 1 )
          print "<tr><th>"$1"</th><th>" $2"</th></tr>"
     else
          print "<tr><td><a href=/iredadmin/profile/alias/general/"$1">"$1"</a></td><td>" $2"</td></tr>"
     }

          END { print "</table>"} ' $TMPFILE > $HTMLFILE
     rm $TMPFILE

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: I would like to have non list aliases in the alias lists

jpforte wrote:

I have many aliases where I do NOT want the to appear in a list to pick from and I have islets = 0 for the alias.

Excuse me, i'm afraid that i didn't understand why you don't like it. What's the problem to have these aliases?

With OpenLDAP, a mail user is allowed to have multiple alias addresses (not mail alias account), for example, user@ has 2 alias addresses like user1@, user2@, all emails sent to user@, user1@, user2@ will be delivered to the same mailbox.

But it's not supported with SQL backends. Maybe we can solve it this way:

1) Add one more column in `vmail.alias`. for example: `alias.isuseralias = 0` (or 1).
2) insert records:

sql> INSERT INTO alias (address, goto, isuseralias, active) values ('user1@xx', 'user@xx', 1, 1), ('user2@xx', 'user@xx', 1, 1);

Postfix is configured to query `alias.address` and `alias.goto`, it doesn't check other columns.

The problem is, `alias.goto` is a TEXT type, we can create a FULLTEXT index if it's MyISAM, but how about InnoDB?

3

Re: I would like to have non list aliases in the alias lists

ZhangHuangbin wrote:

The problem is, `alias.goto` is a TEXT type, we can create a FULLTEXT index if it's MyISAM, but how about InnoDB?

UPDATE: Checked MySQL document (http://dev.mysql.com/doc/refman/5.5/en/ … earch.html):

Full-text indexes can be used only with MyISAM tables. (In MySQL 5.6 and up, they can also be used with InnoDB tables.) Full-text indexes can be created only for CHAR, VARCHAR, or TEXT columns.