autoproc-0.1.2: EDSL for Procmail scripts




data EmailAddress Source


Addr String 


data Mailbox Source


Mailbox String 

data CExp Source


CExp [Flag] Cond Act 


data Act Source


data Match a Source


Match a 


sortBy :: (a -> Cond) -> a -> Mailbox -> Writer [CExp] ()Source

simpleSortByFrom :: String -> Writer [CExp] ()Source

If the email address (the String argument) contains foo, then place the email into a folder by the name foo. Actually, the name of the mailbox is created by appending boxPrefix which is defined in the Configuration module.

type Class = (String, [Cond])Source

subjectToMbox :: String -> String -> Writer [CExp] ()Source

If the subject line contains a certain string, send it to a certain mailbox.

addressToMbox :: String -> String -> Writer [CExp] ()Source

As with subjectToMbox, except by email address.

toAddressToMbox :: String -> String -> Writer [CExp] ()Source

addressToMbox is fine, but may not work well for mailing lists.

stuffToMbox :: Cond -> (a1 -> a) -> (a -> Cond -> Cond) -> String -> [a1] -> Writer [CExp] ()Source

stuffToMbox is a very general filtering statement, which is intended for specialization by other functions.

The idea is to take a logical operator and fold it over a list of strings. If the result is True, then the email gets dropped into a specified mailbox. So if you wanted to insist that only an email which has strings x, y, and z in the subject-line could appear in the xyz mailbox, you'd use .&&. as the logical operator, xyz as the mbox argument, [x, y, z] as the list, and a seed value of True. You also need the subject operator, which will map over the list and turn it into properly typed stuff.

subjectsToMbox :: [String] -> String -> Writer [CExp] ()Source

If all the strings appear in the subject line, deposit the email in the specified mailbox

anySubjectsToMbox :: [String] -> String -> Writer [CExp] ()Source

If any of the strings appear in the subject line, send it to the mbox This is currently a bit of a null-op, and I'm not sure it works.