Vacation/Autoreply plugin question using Virtual Users And Domains with Postfix

Discussion in 'HOWTO-Related Questions' started by triak, May 18, 2006.

  1. triak

    triak New Member

    Hi, I'm a bit stuck here.
    I have put up a production mailsystem, and now I need to implement a Vacation/Autoreply feature.
    The setup is created from Falco's exellent how-to: "Virtual Users And Domains With Postfix , Courier And MySQL (+ SMTP-AUTH, Quota, SpamAssassin, ClamAV)", with the difference of sql-server running on a another host.

    I have setup Squirrelmail for webmail access and it works like a charm.Squirrelmail has a plugin called "Courier Vacation" that creates text files containing information like away-message, cc-address etc. in the virtual users Maildir directory.
    There's a maildroprc file that test's the existence of theese files and accts accordingly. Mail is either autoreplyed or not, kept fowarded to local mailbox or deleted.

    My humble question is: How can I pipe the mails trough maildrop after they have been scaned for viruses etc. What entryes to master.cf main.cf?
    I figure Falco's setup uses procmail for final delivery, can i configure maildrop to do the same thing with this extra funcionality?

    TIA: Johannes Kullberg - TMI TRIAK

    A link to the plugin: http://www.squirrelmail.org/plugin_view.php?id=187
     
    Last edited: May 18, 2006
  2. falko

    falko Super Moderator Howtoforge Staff

  3. triak

    triak New Member

    Yes but...

    We have allready many customers using the Squirrelmail package. It's not an option to start using some other webmail. I really need to get this one working with the maildrop script. Falco, does procmail do the final delivery to the mailbox? Could it be possible to have it done by maildrop?
    The problem with this one is that the system is in production and I can't go the "trial & error" way. I need a solution that works out of the box :=)

    -J-
     
  4. todgerme

    todgerme Member

    you have two options:

    forget procmail!

    a) follow the maildrop filering guide and implement an autoresponder by piping the mail from maildrop .mailfilter file or

    b) take a look at Yaa (http://freshmeat.net/projects/yaa/).

    I have plans to cover these very soon and write a guide for autoresponders so if you can sit tight, i'll try and get something up asap for you.
     
  5. triak

    triak New Member

    Vacation using maildrop allmoast working....

    The Squirrelmail courier-vacation plugin works and a global maildroprc instructs maildrop to read the users vacation directory for vacation messages. The "forward" and "keep messages" functions are working. BUT! the autoreply itself to the sender is not working for some strange reason. I suspect it has someting to do with maildrop marco's. The orginal from address disappears. Heres a clip from the mail log:

    Jun 5 20:01:59 localhost postfix/qmgr[21568]: 486EBF0113: from=<[email protected]>, size=1246, nrcpt=1 (queue active)
    Jun 5 20:01:59 localhost amavis[20433]: (20433-08) Passed, \n<[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, Hits: -1.826

    Jun 5 20:01:59 localhost postfix/pickup[21567]: 62907F0116: uid=5000 from=<>
    Jun 5 20:01:59 localhost postfix/cleanup[22065]: 62907F0116: message-id=<[email protected]>
    Jun 5 20:01:59 localhost postfix/pipe[22082]: 486EBF0113: to=<[email protected]>, relay=maildrop, delay=0, status=sent (axyz.fi)
    Jun 5 20:01:59 localhost postfix/cleanup[22065]: 62907F0116: to=<unknown>, relay=none, delay=0, status=bounced (No recipients specified)

    Postfix is trying to send the replymail, but does not know the recipient.
    The problem is obvious, but how can I fix this so that the correct string is passed back to postfix?
    I will attach my maildroprc and master.cf configuration files.
    The maildrop filtering is added to Falco's virtual system using this howto:
    http://www.howtoforge.com/postfix_mailfilter

    The holidays here in Finland are just starting and I'm in a bit of trouble here...
    Plz help a bit :=)
     

    Attached Files:

  6. triak

    triak New Member

    Nobody knows the answer?

    I have been searching maildrop and postfix documents, googling my ass off,
    asking friends etc. ... Does anybody know how to deal with this problem. My customer's are starting to get stressed, and I really need to get this vacation thing working.....
    TIA: Johannes
     
  7. falko

    falko Super Moderator Howtoforge Staff

    It seems as if the recipient is not set correctly in

    Code:
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/local/maildrop/bin/maildrop -d ${user}@${nexthop} ${extension} ${recipient} ${user} ${nexthop} ${sender}
    in master.cf. What happens if you replace ${recipient} with a hard-coded email address (e.g. yours) for testing purposes? Do you receive the autoreply emails then?
     
  8. triak

    triak New Member

    Nope, does not help

    Changing the recipient macro does not affect anyting.
    The log is exactly the same and no autoreply address is beeing delivered to cleanup daemon.
    How is the macro's forwarded to maildrop? $1 $2 $3 etc. Maybe the numbers are getting mixed up....
     
  9. falko

    falko Super Moderator Howtoforge Staff

    Did you restart Postfix?
    What's in master.cf now?
     
  10. triak

    triak New Member

    Tried both reload and restart

    Now I have the following string:

    maildrop unix - n n - - pipe
    flags=hu user=vmail argv=/usr/local/maildrop/bin/maildrop -d ${user}@${nexthop} ${extension} [email protected] ${user} ${nexthop} ${sender}

    $1 is ${user}@${nexthop}
    $2 is ${extension}

    Is this the way macros get distributed to maildrop?
     
  11. falko

    falko Super Moderator Howtoforge Staff

    That should be correct. But $1 is ${extension} ans $2 is ${recipient}.

    You can add
    Code:
    echo "$2" > /tmp/testfile
    to your maildroprc. Then you can check if the correct recipient email address is written to /tmp/testfile.
     
  12. MarcelDeR

    MarcelDeR New Member

    Add in maildroprc between "sendmail" and "-f" a "-t" to tell sendmail to look in to the message for the addresses.

    Greetings from Holland
     
  13. triak

    triak New Member

    Got it!

    I added the -t option to sendmail in maildroprc and changed the $FROM variable to $RECIPIENT at the bottom of the script. And now it works!!

    I ran into another problem. Maildrop should auto-create maildirs and vacation directory when mail arrives. Can't figure out why the directory creation fails.
    In the same script the "test" command works fine with vacation messages and maildrop parses theese messages.

    mkdir -p /var/vmail/$HOST/$USER does not work. Maildrop complains about not beeing able to change to home directory.
    Is there a difference in wich stage of the script this command is run?

    .j
     
  14. falko

    falko Super Moderator Howtoforge Staff

    I guess this is some kind of permissions problem.
     
  15. todgerme

    todgerme Member

    triak, have you tried a simple maildrop filter yet, not globally to test maildrop is working correctly, like the one I placed in the guide to filter spam? better to crawl before you can walk.

    after that i would modify that script, try piping to the vacation (apt-get install vacation) program with vacation.msg files instead of having different files for subject etc etc and using sendmail as I saw looking at your maildroprc file.

    otherwise if you are struggling to get an autoreponder working, use yaa and write a quick gui for users to setup the autoresponder.

    let me know how you get on with the basic spam filter first.
     
  16. triak

    triak New Member

    Vacation plugin working... but lost forwarding ability

    It seems that the virtual transport method was responsible of forwardings using this setup. How can i implement simple forwardings to my maildroprc?
    They are not so many so I can wrtite them straight to the script.
    Or maybe use the existing mysql forward table?
    And another bug that appeared after switching to maildrop, mail for [email protected] (mail is the servers hostname) that should go to [email protected] does not get delivered anymore. How can i address all mail for mail.abs.fi to abc.fi? Theese are important mail's such as root, postmaster etc.

    tia. Johannes
     
  17. falko

    falko Super Moderator Howtoforge Staff

    Did you have a look here? http://www.courier-mta.org/?maildrop.html


    I think you can do that with transports.
     
  18. todgerme

    todgerme Member

    i am not entirely sure what you by transports but if you look at the mail filter guide for maildrop, you will see you can simply transport any email address ot the maildrop transport when required.

    instead of having a global maildroprc to handle autoresponders have individualised ones, with something similar to:

    logfile "/u0/vmail/.mailfilters/mailfilter-log.txt"
    | /usr/bin/vacation
    log "Firstly piped mail to vacation program "
    cc "/home/vmail/example.com/user/new"
    log "deliver mail to users mailbox aswell! "

    i hope it helps.
     
  19. wierben

    wierben New Member

    Did anyone got this working? I tried and tried, can't get the mail to go through the maildrop pipe. Is there a setting i'mn ot seeing?
     

Share This Page