I'd like to connect to our mail server via POP3, look for a certain pass phrase in the subject and if found then run a script.How can I achieve this with BASH other than awkwardly scripting Telnet?Thanks!
Querying a remote POP3 Mail server using BASH
shell script;email
The typical tool to query POP3 servers from the commandline is fetchmail which you can instruct to leave the original messages on the mail server (the 'keep' option or nokeep to empty the mailbox after downloading the messages)  and then procmail is the typical mail filter, which can be used to trigger your script.A sample .fetchmailrc would be someting like:poll pop.example.com with proto pop3:        user username.on.example there has password S3cr3t        is herman here and wants ssl nokeep         mda /usr/bin/procmail -t /home/herman/.procmailrc.pop.example.comAnd the .procmailrc.pop.example.com file contains a matching rule on a specific Subject: line to trigger your script. The complete message will be passed as STDIN to the script as normally scripts would actually do something with an email message.:0^Subject: passphrase| /home/herman/bin/script