Hello Monks, My mailsystem (Postfix) is currently set to deliver all spammy/infected emails to a global junk folder. As it stands, emails are gzip'ed and then dropped in this folder after they fail scanning. There doesn't seem to be much for options to deliver to a user-folder for SPAM, nor is there anything in the file naming which indicates the ultimate recipient (which I suppose makes sense, as there could be multiple recipients). Now, I've made a script which reads in the userbase to a hash, and subs in values from /etc/aliases as needed. It reads the GZIP'ed email (using Compress::Zlib) and identifies the recipient from the X-Envelope-To header and compares against valid users/aliases (probably won't work with multi-recipient mail, but that's a task I'll work on after. It does work for multi-user aliases aka lists) So... what I'd like to do is either: Now, since the script will be running under cron and probably at times have a lot of junkmail to deal with, I may limit it to X messages per run. For deleting the SPAM email, I'm thinking that Symlinks are the way to go. As it would be:

Check the spool folder. If message is older than $EXPIRY (say, about 1 week), nuke it, or if message has no more symlinks (meaning that all linked user's have deleted it). The alternative, of course, is to scan the ~/Maildir/.Junk/cur and ~/Maildir/.Junk/new Either way has problems. Symlinks: The issue with making physical copies of the file is much the same: So, does anyone have a better way of doing this, or some pointers on how I'm doing it now?

In reply to Routing SPAM emails to a junk folder by darkphorm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.