On 3/6/06, Marlier, Ian
From: Per Jessen [mailto:per@computer.org]
I'm trying to find some kind of a simple utility/script that will allow me to list the messages in an arbitrary POP3 mailbox to STDOUT.
Anyone have thoughts on the easiest way to do this?
I wonder if perhaps fetchmail would let you do something like that?
That was my first thought, but there isn't anything in the man page that would suggest that it'll work...
Although, I guess I could run it with something like `--mda "grep Subject:"` in the command line...that might work.
Basically, I'm trying to figure out a way to do a mail loop-test. I'm hoping to end up with a script that'll send mail to a specified address, sleep for a specified amount of time (10 seconds?), and then check for it in the recipient mailbox...if I can just put a unique token into the subject line and then do a grep -c to check for its presence, that'll do the trick, I think...(then I can drop it into Nagios as a plugin, and so on...)
Hrm...I'll keep playing with the fetchmail idea...that's interesting...
Checking for email with telnet is easy as is: telnet server 110 user myuser pass passwd list to get the list of the emails top #msg 0 to list all headers for message #msg here are some examples how to script the telnet program: http://linuxgazette.net/issue50/tag/34.html Make some of them to output to stdout so you can pipe to grep :) Looks interesting ... :) -- -- Svetoslav Milenov (Sunny)