1

Topic: Postfix aliases - Email pipe script

Hi,

I have a virtual domain with email support@virtualdomain.com

I want to setup a script pipe alias .. e.g.

support@virtualdomain.com: "|/var/www/html/emails.php"

How can I achieve this?

I tried this in /etc/postfix/aliases file, but getting an error

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

Please let me know.

----

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

2

Re: Postfix aliases - Email pipe script

You should use transport instead of aliases.
Reference:
- http://www.postfix.org/FILTER_README.html#simple_filter
- http://wiki.zimbra.com/wiki/Configuring … ed_scripts

3

Re: Postfix aliases - Email pipe script

ZhangHuangbin wrote:

You should use transport instead of aliases.
Reference:
- http://www.postfix.org/FILTER_README.html#simple_filter
- http://wiki.zimbra.com/wiki/Configuring … ed_scripts

Hi Zhang,

I am using mysql ... should I add a system user "filter"  just for one virtual email pipe?

Can you please explain with an example? I am newbie as far as postfix is concerned.

4

Re: Postfix aliases - Email pipe script

ZhangHuangbin wrote:

You should use transport instead of aliases.
Reference:
- http://www.postfix.org/FILTER_README.html#simple_filter
- http://wiki.zimbra.com/wiki/Configuring … ed_scripts

Hi Zhang,

Can we do it this way?

-------------------------------------------------------------------------------------------------
There seems to be another way to do the same thing without filters.
Define local adress in /etc/aliases to process email with your script
and redirect your virtual mail to it. The sequence is as follows:

1. /etc/aliases
yourtest: "|/web/helpdesk/cli/index.php"

2. /etc/postfix/virtual
test@mynetmarketingsupport.com  yourtest
-------------------------------------------------------------------------------------------------

5

Re: Postfix aliases - Email pipe script

Seems OK, you should test it first.

Also, iRedMail uses /etc/postfix/aliases instead of /etc/aliases by default, please check your config.

6

Re: Postfix aliases - Email pipe script

Hi Zhang,

Yes, that will be /etc/postfix/aliases

Here I am using mysql as backend.

virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql_domain_alias_maps.cf


Does this mean that my /etc/postfix/virtual will not be used?

7

Re: Postfix aliases - Email pipe script

Simply add one, like this:

virtual_alias_maps = hash:/etc/postfix/virtual, proxy:mysql:xxxxxxxxxxxxxx

Restart postfix to make it work.

8

Re: Postfix aliases - Email pipe script

ZhangHuangbin wrote:

Simply add one, like this:

virtual_alias_maps = hash:/etc/postfix/virtual, proxy:mysql:xxxxxxxxxxxxxx

Restart postfix to make it work.

Dear Zhang,

I tried that ..

aliases
richard.correia: '|/var/www/html/miscell/informatemi/PHPMailer_v5.1/examples/test_mail_advanced.php'

Virtual
richard.correia@virtualdomain.com richard.correia



The mail bounced, the error I am getting is

<'|/var/www/html/miscell/informatemi/PHPMailer_v5.1/examples/test_mail_advanced.php'@mail.airsur.net>:
   unknown user:
   "'|/var/www/html/miscell/informatemi/phpmailer_v5.1/examples/test_mail_advanced.php'"

Final-Recipient: rfc822; '|/var/www/html/miscell/informatemi/PHPMailer_v5.1/examples/test_mail_advanced.php'@mail.airsur.net
Original-Recipient: rfc822;richard.correia@virtualdomain.com
Action: failed
Status: 5.1.1
Diagnostic-Code: X-iRedMail; unknown user:
   "'|/var/www/html/miscell/informatemi/phpmailer_v5.1/examples/test_mail_advanced.php'"



Can you help?

9

Re: Postfix aliases - Email pipe script

This worked ..

Thanks for all your help Zhang ...

10

Re: Postfix aliases - Email pipe script

Can you share with us what you exactly do to achieve this?

11

Re: Postfix aliases - Email pipe script

Hi,
Added a system user richard.correia

In /etc/postfix/aliases
richard.correia: "|/var/www/html/miscell/informatemi/PHPMailer_v5.1/examples/test_mail_advanced.php"

In /etc/postfix/virtual
richard.correia@virtualdomain.com richard.correia

in main.cf, added "hash:/etc/postfix/virtual" to following variable

virtual_alias_maps = hash:/etc/postfix/virtual, proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/mysql_domain_alias_maps.cf

I want this simple pipe for a single email address on on virtual domain. Hence I was not feeling good to add a system wide filter.

Richard

12

Re: Postfix aliases - Email pipe script

Thanks very much for your sharing. smile