Howto let procmail move spam to folder?

Discussion in 'HOWTO-Related Questions' started by oversight, Apr 21, 2006.

  1. oversight

    oversight New Member

    I followed the briljant tutorial from falko and got my system up and running in notime. Thanks falko.

    However, I want my spam in the folder spam. or Junkmail or..... any folder I like.
    How do I implement this by using procmail?

  2. falko

    falko Super Moderator Howtoforge Staff

  3. oversight

    oversight New Member

  4. falko

    falko Super Moderator Howtoforge Staff

    I haven't tested, but you can try to do this:

    postconf -e 'mailbox_command = /usr/bin/procmail'
    /etc/init.d/postfix restart
    Then create a global procmail recip /etc/procmailrc.
  5. sjau

    sjau Local Meanie Moderator

    does a local .procmailrc folder in the email users "Home Mail" folder always work or does that need to be enabled?
  6. falko

    falko Super Moderator Howtoforge Staff

    It should always work with system users, however overdight is using virtual users, that's why I suggest a global procmailrc.
  7. todgerme

    todgerme Member

    i suspect the way around this problem is to pass the particular domain through a different MDA. I'm not sure if Postfix even looks at .forward files when using Virtual Users so I'm not convinced you can call Procmail with a .forward file.
    I have repeatedly tried to get .forward files working but no look yet with Virtual users:
    A quick show of the Postfix defaults shows:
    # postconf -d | grep .forward
    forward_path = $home/.forward${recipient_delimiter}${extension}, $home/.forward
    I have tried specifying all sorts in the forward but it just seems to ignore whatever I do.

    Also I have read in a few places that the Procmail command only works for local users and not Virtual Users so I'n not convinced a Global procmail script will work although never say never.

    So two ways forward I can see:

    The Postfix conf shows virtual_transport = virtual, we could change this maildrop or procmail, however that will mean all mail will be delivered using these agents and maildrop for example can't make its own directories the way the Postfix virtual agent does so it's probably best to leave this as is.

    So like the way you can pass mail off to Yaa to get an autoresponders through the transport layer, I would suggest the same but passing it off to Maildrop/Procmail. Obviously a Procmail entry would need to be made in the file but there should already be an entry for maildrop. In addition you'll need to create a maildroprc file in /etc to reflect users directories and tell it to check for maildroprc files in the various home directories but I don't think that should be a big issue. One further idea would be to try and enable Mysql Virtual users in the maildrop source for Debian, a simply configure switch can have Maildrop looking at the database. From there, the exisiting guide will need to be modded so that it gets its maildir information from the database and not from concats of the email address on top of the vmail home directory should look like this
    maildrop unix - n n - - pipe
    flags=DRhu user=vmail argv=/usr /bin/maildrop -d ${recipient}

    then you should have something like -> maildrop in your transport MySQL tables.

    Ignoring most of this punters guide:

    look at the maildrop bit, he includes a maildrop script that would be perfect for creating the directories with maildirmake, and allowing for per domain maildrop scripts.

    So a little work required but not impossible! Hope it helps
  8. todgerme

    todgerme Member

    i have prepared a guide for the very thing so check it out. it was done in a real rush but i do have it working so if you run into any problems, give me a shout. next thing to do is to try and have all the filtering MySQL driven, so no need for flat files at all!!!
    Last edited: May 1, 2006
  9. falko

    falko Super Moderator Howtoforge Staff

  10. todgerme

    todgerme Member

    yeah already have plans to smarten it up, it reads awful, done in a big rush! I'm gonna add one for the Yaa autoresponder too and that should stop two of the biggest questions on this forum!

Share This Page