alter e-mail adress (using maildrop?)

Discussion in 'Server Operation' started by HoUsECAt, Dec 11, 2006.

  1. HoUsECAt

    HoUsECAt New Member

    I'm currently investigation a solution to alter e-mail adresses into a name.

    My server can send sms trough a service provided by a third party. I'm getting replies on these sms'es... But these replies only include the mobile number of the replier, like:

    [email protected]

    I would like to create some sort of a database on my server (using postfix (maildrop) with virtual users and courier imap from tutorial) which can add or translate that e-mail adress to a understable name

    Any ideas?
  2. falko

    falko Super Moderator ISPConfig Developer

    I think you can do it with maildrop and formail to change the header of the email. See
    man formail
  3. HoUsECAt

    HoUsECAt New Member

    formail is not on the standard installation nor on any repository for ubuntu?
  4. HoUsECAt

    HoUsECAt New Member

    ah i see... it's a packages that comes along with procmail?
  5. HoUsECAt

    HoUsECAt New Member

    i now found something how maildrop can pipe the message to PHP, via STD IN/OUT

    any experiences with this solution? and how to get it back to deliver in the imap box?
  6. falko

    falko Super Moderator ISPConfig Developer

    This is a small example how you can read from STDIN with a PHP script:


    function getInput() {
    $fr fopen("php://stdin""r");
      while (!
    feof ($fr)) {
    $input .= fgets($fr);

    $input getInput();
    Then you can process the input in the PHP script, and to get the new message to STDOUT, just echo it.
  7. HoUsECAt

    HoUsECAt New Member

    i'm not getting anything piped out trough stdout... should it really be like this:

    echo "To: [email protected]\n";
    mysql_num_rows($result) == 1) {
    "From: " mysql_result($result0) . ' <' $from ">\n";
    else {
    $from "\n";
    $subject "\n";
    $message "\n";
    and the maildroprc file for this account:

    to "| /usr/bin/php -q /home/vmail/.mailfilters/ident.php"
    Last edited: Dec 13, 2006
  8. falko

    falko Super Moderator ISPConfig Developer

    You should put another pipe behind the PHP script and pipe the output into some other tool.
  9. HoUsECAt

    HoUsECAt New Member

    do you have any examples on how to achieve that? i'm trying several things with echo and fwrite

    # fopen('php://stdout', 'w');
    # fwrite(stdout, "To: [email protected]\n");
    but none of this works.

    Any idea on how the mail output should look like?

  10. falko

    falko Super Moderator ISPConfig Developer

    Maybe you should use STDIN and STDOUT instead of php://stdin and php://stdout.

    Have a look here:

Share This Page