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.

Where can I tell exim to run a shell/php command everytime a new mail has been delivered to a virtual mailbox. It does not matter to which user the mail is delivered?

share|improve this question
add comment

3 Answers 3

up vote 0 down vote accepted

You want to look at shadow_transport.

For local deliveries (only), if delivery succeeds and the Transport references another Transport in its shadow_transport option, then that second transport will also be invoked.

You'd then have that second Transport be a driver = pipe transport.

Eg:

maildir_delivery:
  driver = appendfile
  directory = ...blah blah whatever ...
  maildir_format
  # various other maildir extension options if needed
  shadow_transport = audit_delivery

audit_delivery:
  driver = pipe
  command = /some/path/to/some/command with some options
  user = audituser
  group = mail
share|improve this answer
add comment

Given that you apparently have a real user to deliver to, you probably want to look into using a .forward file, or possibly procmail if you want to get a bit fancier (such as if you only want to run the command for a subset of messages delivered to the user).

share|improve this answer
    
Unfortunately I am having a multi user/domain system via exim4/mysql/courier-imap I meant with local user, that this user is terminated in my system. But it should be called disjunct from the user recieving the mail. –  user28047 Dec 28 '09 at 19:51
    
"local user" has very specific meaning with MTAs, you might want to edit your question to say "virtual mailbox" if you're running that sort of system. –  womble Dec 28 '09 at 22:52
    
thx, I have corrected the question. –  user28047 Dec 30 '09 at 12:29
add comment

The easyest way I found was creating a new router afterwards delivering to the local users containing:

runscript:
        driver = accept
        transport = run_script
        unseen
        no_expn
        no_verify

So, the mail is still handeld the way it should be and my script is running, with the right transport f.e.:

run_script:
        debug_print = "T: run_script for $local_part@$domain"
        driver = pipe
        path = "<path>"
        command = "<command to be run>"
share|improve this answer
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.