adding Server side mail filters to Virtual Users And Domains With Postfix 7.10

Discussion in 'HOWTO-Related Questions' started by c0mputernick, Jan 23, 2008.

  1. c0mputernick

    c0mputernick New Member

    Has anyone added server side mail filters to their "Virtual Users And Domains With Postfix, Courier And MySQL Ubuntu 7.10" setup?

    I would like to, but am unsure what to change in postfix/maildrop to be able to add this functionality. Can anyone assist me with this? Ive found some related gentoo material creating the file: /home/vmail/.mailfilter with this inside:
    "
    xfilter "/usr/bin/spamc"
    # Check for user defined filter file
    exception {
    include "$HOME/mailfilters/$LOGNAME"
    }
    "
    and then creating this file that holds the filters for this particular user:
    /home/vmail/mailfilters/[email protected]

    But i need to know how to change postfix to hand the mail off to maildrop instead of its normal delivery.

    Any help would be much appreciated.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Why don't you use amavisd as shown in the tutorial?
     
  3. c0mputernick

    c0mputernick New Member

    i am. Im not talking about spam/virus filtering. Im talking about sorting mail, or server side mail filters. Where i can put mail as it comes into the server into its respective folder, normally via maildrop.
    Unless i missed something (and ive done the setup at least 10 times by now) i didnt see an option (or even know that amavisd does mail sorting) to do mail sorting.
    If i missed something please point it out, i have read and reread the entire setup from start to finish several times and must be missing what your referring to.

    Thanks for the help.
     
  4. falko

    falko Super Moderator Howtoforge Staff

  5. c0mputernick

    c0mputernick New Member

    Thats exactly what i was looking for! Thanks for the links!
     
  6. c0mputernick

    c0mputernick New Member

    I wonder if there is a way to link or add links to the end of a particular how-to so other users can find them easier?
    Like "Add-ons for Postfix Guide 7.10" or something similar.
     
  7. falko

    falko Super Moderator Howtoforge Staff

    I'm already adding links to related tutorials at the end of the tutorials. Do you mean that users should be able to add links themselves?
     
  8. c0mputernick

    c0mputernick New Member

    I followed all the instructions perfectly, double checked them, but im getting an error in my syslog and mail is getting bounced before i even send a test for the filter:

    postfix/pipe[25281]: 9F6B874D750: to=<[email protected]>, relay=maildrop, delay=20738, delays=20738/0.03/0/0.04, dsn=5.1.1, status=bounced (user unknown. Command output: Invalid user specified. )

    The user is correct, it should be vmail as in the guide with uid/gid of 5000

    I think it has something to do with the line changed in master.cf for maildrop:

    maildrop unix - n n - - pipe
    flags=DRhu user=vmail argv=/usr/local/maildrop/bin/maildrop -d ${user}@${nexthop} ${extension} ${recipient} ${user} ${nexthop} ${sender}

    I am using the falko guide for ubuntu 7.10 and i did have to change the path names in the filter part from:
    /u0/vmail/.mailfilter/[email protected]
    to:
    /home/vmail/.mailfilter/[email protected]
    because that is where the mail and filters are held.

    I start getting those errors as soon as i add this section:
    VALUES ( 'mydomain.com', 'maildrop' ); in the transport table.

    Ive checked for type-o's and their dont seem to be any, which is why i think its something to do with the line in master.cf (mainly because i dont understand all the ${} stuff, it could be right, but i wouldnt know it. Do you have to change it at all for ubuntu 7.10?

    I hope im not the only one that has ran into this and im crossing my fingers its a simple fix, it seems im almost there (if the filters actually work after this)


    Also, you said in the how-to that you could filter mail on a per users basis instead of the entire domain. "(important to note you can do this on a purely per email basis ie, all emails but [email protected] go to the normal virtual transport and by adding in the email address and a maildrop transport)"
    How is this done? instead of adding "mydomain.com, maildrop" would you add "[email protected], maildrop" instead in the transport table?

    Thanks for any and all help.
     

Share This Page