1

This is what I am trying to do:

I have a server using Postfix on a Ubuntu precise 64bits and I have a table list of emails in /etc/postfix/virtual, like this:

[email protected]  [email protected]
[email protected] [email protected]

Now I want to put a filter that get all mails sent and add some prefix to the subject or add something else to the end of the mail.

In the file /etc/postfix/master.cf I put:

filter    unix  -       n       n       -       10      pipe
  flags=Rq user=filter argv=/home/filter/filtro.php -f ${sender} -- ${recipient}

I created the user filter and put the file /home/filter/filtro.php:

#!/usr/bin/php
<?php
$myFile = "/home/filter/testFile.txt";
$fh = fopen($myFile, 'a');
fwrite($fh, "\n-----------------------\n");
fwrite($fh, json_encode($_SERVER['argv']) );
?>

It was just to see if it´s working. But it´s not. Anyone can see a light for my problem?

Thanks!

2
  • What are you trying to achieve? It will be better if u can say what u want exactly.
    – clement
    Mar 6, 2014 at 17:57
  • Ok. Right. I didnt do anything inside filtro.php because I wanted to see if this filter would work, but what I want to do is add something like [[email protected]] before the subject text and add a text at the end of the content message saying "This message was sent to [email protected]." Mar 6, 2014 at 18:30

1 Answer 1

0

You can use mimedefang configured as smtpd_milter with postfix. It can change/add/delete headers (action_change_header/action_insert_header/action_delete_header) and append text (append_text_boilerplate) to the mails. More info here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .