Other than procmail what Unix tools can "read" an email via pipe? I have a client that wants to develop an app on a university managed (read squeamish IT dept) server. Procmail is not installed and neither is PHP's IMAP extension. What other programs or scripts can accept a piped email as input?
Asked
Active
Viewed 205 times
1
-
Access it's headers and content for further processing. – jerrygarciuh Oct 18 '11 at 02:19
-
1How about http://www.courier-mta.org/maildrop.html ? – Jon Lin Oct 18 '11 at 02:23
-
Ok - but do what with it? Route mail with certain subject lines elsewhere - drop mail with keywords in body - delete every 3rd mail sent by person X - copy the mail to a archive? – Adrian Cornish Oct 18 '11 at 02:24
-
@Adrian - I'm stumped as to how it matters in relation to the question at hand but the script would process the mail depending on what address the headers purported that it came from and update some database tables based on the body contents and then notify relevant persons of the updated information. – jerrygarciuh Oct 18 '11 at 02:51
-
1@jerrygarciuh Depends what you wanted to do. Say you piped your emails into | wc -c then you get a byte could of your emails but what if you did awk '{ if($0 ~ /^Mail from: dave@nowhere.com/) print "warning"; }'. Basically you asked for 'unix tools' to do something magic - the answer depends on what magic do you want to do. Every unix program can 'read' and email - it depends on how it deals with it, error, do nothing, copy it, react on it, take is a series of git patches and apply it to your working tree? etc – Adrian Cornish Oct 18 '11 at 03:03
-
Maildrop is similar to Procmail in functionality (but not at all in design) -- if he cannot install Procmail then he can hardly install Maildrop either. – tripleee Oct 18 '11 at 07:46
-
Thanks Adrian. I see your point. – jerrygarciuh Oct 19 '11 at 14:56
1 Answers
0
Unless I misunderstood the question (which, now that I reread it a few times, i may have) but....Mail files are just text files that the mail
command parses and provides a front end for. You can use cat
, vi
, or any of the like to process the mail file:
cat /var/spool/mail/`whoami`
vi /var/spool/mail/`whoami`
grep -A10 "To: bob@bob.com" /var/spool/mail/`whoami`
....
Check out Admin Guide - Managing the Mail

chown
- 51,908
- 16
- 134
- 170