Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running a mail server on Ubuntu with Postfix, Amavisd, and virtual users through MySQL. I'd like to have the email body piped through an external script upon receipt, but only for one particular email recipient. The way I started going about this was to create a new transport called "vtimer" in master.cf:

vtimer    unix  -       n       n       -       -       pipe
  flags=Fq   user=vmail       argv=/opt/vacationtimer.php ${recipient}

Then I created a new entry in the transport file:

vacationtimer@example.com vtimer

Lastly, I ran postmap on the transport file and restarted Postfix (the entry in main.cf already exists because I have other functional transports currently in place). The difference between this transport and others is that the others match hostnames, but this is the only one that matches on a specific address. When an email is received at this address, it does not redirect through this transport, but instead goes through the default one that is used when none are matched.

Is this the right way to go about this? If so, what am I missing? If not, what other option(s) should I be looking at?

share|improve this question

migrated from superuser.com Jul 4 '13 at 11:33

This question came from our site for computer enthusiasts and power users.

add comment

1 Answer

up vote 0 down vote accepted

I suspect the problem you are having is the syntax of your command in the transport table.

vacationtimer@example.com vtimer:

Note the ":" at the end of the line to advise the transport to use, and which was missing in your example.

The way I handled a similar requirement was to set the user up in /etc/aliases with a pipe to the script -

username: "| command to pipe email into"

I set up a virtual_alias_maps entry I then set a transport map in the main.cf file with the line

username@domainname.co.nz local:

So that user was treated as a local system user.

I think this is easier and more flexible then creating entries in the master.cf file.

share|improve this answer
    
The colon wasn't the issue, I had tried that as well. However, your suggestion to run it through /etc/aliases and local: was spot on and that worked perfect, thank you! –  Nick Coons Jul 3 '13 at 1:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.