1

Topic: shell scripts in aliases

Hi,

I'am migrating from old mail server (with sendmail) to iRedMail. In the old server we have aliases which redirects to shell scripts, for example:

pager:     "|/usr/lib/pager.pl", user1
reader:   "|/usr/lib/reader.pl"

So, the question is how to make similar aliases in iRedMail?

----

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

2

Re: shell scripts in aliases

You can use same settings with Postfix. For example, if you use "alias_maps = hash:/etc/postfix/aliases" in old mail server, you can use same setting in iRedMail.

3

Re: shell scripts in aliases

ZhangHuangbin wrote:

You can use same settings with Postfix. For example, if you use "alias_maps = hash:/etc/postfix/aliases" in old mail server, you can use same setting in iRedMail.

Okey, I added a new string to /etc/postfix/aliases in my new server with iRedMail:

smspager: "|/usr/local/scripts/pager.pl"

After it, I run a command "newaliases".
There are two lines in main.cf:

alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases

So, everything looks fine, but how to trigger this alias (smspager)? I tried to make a forward for a mailbox to "smspager", but iRedAdmin doesn't allow it. I even tried to change mailForwardingAddress parameter directly in ldap, despite this I always see in postfix log: status=bounced (user unknown)

4

Re: shell scripts in aliases

"smspager" should be a user like this: smspager@[YOUR_HOSTNAME].
You can get hostname with command: "hostname -f", for example: smspater@demo.iredmail.org.

5

Re: shell scripts in aliases

ZhangHuangbin wrote:

"smspager" should be a user like this: smspager@[YOUR_HOSTNAME].
You can get hostname with command: "hostname -f", for example: smspater@demo.iredmail.org.

If I do so, I get a warning:

postalias: warning: /etc/postfix/aliases, line 100: name must be local

Line 100 looks like so:

smspager@klinika.lt: tadas@gmail.com

Also, it doesn't work, so your solution isn't correct I think.

6

Re: shell scripts in aliases

Sorry, i didn't explain clearly.
My original mean is, you should send mail to "smspager@[YOUR_HOSTNAME]" instead of mailing to "smspager" (without domain part).

You can use 'smspager: "|/usr/local/scripts/pager.pl"' in /etc/postfix/aliases, and then run "postalias" instead of "newaliases":

# postalias /etc/postfix/aliases

As i remember, newaliases will update /etc/aliases, not /etc/postfix/aliases. but you have "alias_maps = hash:/etc/postfix/aliases" in postfix, so it's recommended to always use the exact path.