Skip to content

Instantly share code, notes, and snippets.

@infotroph
Last active December 18, 2015 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infotroph/5851440 to your computer and use it in GitHub Desktop.
Save infotroph/5851440 to your computer and use it in GitHub Desktop.
#Exim filter
logfile $home/eximfilter.log
logwrite "orig_local: $original_local_part"
if error_message then
logwrite "Error message; not filtering"
finish
endif
if ($original_local_part is "chris" and $h_from: contains "@github.com") then
save mail/github
elif ($original_local_part is "bills" or $original_local_part is "music") then
save mail/music
elif (($original_local_part is "alsochris" or $original_local_part is "chris")
and $h_from: contains "twitter.com") then
save mail/twitter
elif ($original_local_part is "lj") then
save mail/lj
elif ($original_local_part is "flickr") then
save mail/flickr
elif ($original_local_part is "inkling") then
save mail/inkling
elif ($original_local_part is "aim"
or $original_local_part is "apple"
or $original_local_part is "bb"
or $original_local_part is "bluesbodger"
or $original_local_part is "bodger"
or $original_local_part is "chris"
or $original_local_part is "chrisb"
or $original_local_part is "gmail"
or $original_local_part is "hpeb"
or $original_local_part is "oddry"
or $original_local_part is "plantchris"
or $original_local_part is "webform") then
deliver chrisb
else
# Switch these once confident it's working righ!
# seen finish
logwrite "trashed"
save mail/eximwilltrash
endif
@infotroph
Copy link
Author

  1. is $original_local_part what I actually want?
    --maybe I want $h_Envelope_to:?
    --sane with multiple recipients? (ideally: accept "chris@bodger.org, jim@example.com" but reject "chris@bodger.org, jim@example.com, nonexistant@bodger.org"
  2. deliver chrisb vs save /var/mail/spool?

@infotroph
Copy link
Author

Test message, properly send to eximwilltrash:

Return-path: black11@igb.illinois.edu
Envelope-to: herniated@bodger.org
Delivery-date: Mon, 24 Jun 2013 11:13:15 -0700
Received: from mail.igb.illinois.edu ([128.174.124.10] helo=mail.igb.uiuc.edu)
by panharmonicon.com with esmtp (Exim 4.72)
(envelope-from black11@igb.illinois.edu)
id 1UrBGN-0008UH-G4
for herniated@bodger.org; Mon, 24 Jun 2013 11:13:15 -0700
Received: from [172.16.3.153](radius.igb.illinois.edu [128.174.124.46])
(using TLSv1 with cipher AES128-SHA (128/128 bits))
(No client certificate requested)
(Authenticated sender: black11@mail.igb.uiuc.edu)
by mail.igb.uiuc.edu (Postfix) with ESMTP id 0E334408FC
for herniated@bodger.org; Mon, 24 Jun 2013 13:13:04 -0500 (CDT)
From: Chris Black black11@igb.illinois.edu
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: filter test: junk
Message-Id: 603E2C7D-7497-4093-85A5-B01689C8EEF5@igb.illinois.edu
Date: Mon, 24 Jun 2013 13:12:46 -0500
To: herniated@bodger.org
Mime-Version: 1.0 (Mac OS X Mail 6.5 (1508))
X-Mailer: Apple Mail (2.1508)
X-NEWIGB-MailScanner-Information: Please contact the ISP for more information
X-NEWIGB-MailScanner: Found to be clean
X-NEWIGB-MailScanner-SpamCheck: not spam (whitelisted),
SpamAssassin (not cached, score=-2.9, required 5, autolearn=not spam,
ALL_TRUSTED -1.00, BAYES_00 -1.90)
X-NEWIGB-MailScanner-From: black11@igb.illinois.edu
X-Spam-Status: No

this should get trashed

Christopher K. Black
PhD Candidate
University of Illinois Plant Biology
black11@igb.illinois.edu
503 929-9421
Room 1500, Institute for Genomic Biology
1206 W Gregory Drive
Urbana, IL 61801

@infotroph
Copy link
Author

Real live spam, delivered to inbox:

Return-path: <>
Envelope-to: herniated@bodger.org
Delivery-date: Mon, 24 Jun 2013 11:00:46 -0700
Received: from 190.25.228.33
by panharmonicon.com with smtp (Exim 4.72)
id 1UrB4I-0008RQ-It
for herniated@bodger.org; Mon, 24 Jun 2013 11:00:46 -0700
Received: from unknown (HELO localhost) (tamura@restel.net@131.37.146.209)
by 190.25.228.33 with ESMTPA; Mon, 24 Jun 2013 13:03:22 -0500
From: tamura@restel.net
To: herniated@bodger.org
Subject: THIS STOCK COULD ROAR BACK TO LIFE

Get prepared for Huge Rally play!!! We have observed it often as seller
broker manipulation try to entice panic to investors to eliminate most of
their shares at super cheap levels and recently was similar activity. What
they achieved was build up a Massive profit opportunity for us long and
strong investors. With winning team and exciting news ready to hit the
wires, H A_I_R shall quickly rally hitting record levels soon. We are
definitely taking this ability to buy and hold our holdings long period for
Gigantic gains. We notified you to assume the Massive Rally and its
approaching. The latest share amount lately attained the absolute low, today
its time to grab as many as you can. Gigantic developments are underway.
Just look whats progressing with the YouTube promotions. Youtube has being a
important collaborator for patients attainment for H A_I_R. Big news
approaching and today is the time to buy, when the share value reaches the
low you should buy as plenty as you may.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment