Nail is a lightweight mail client for sending and receiving e-mail messages. Please note that around 2007 the nail changed it's name to Heirloom mailx. The Sourceforge says that:
To read mail (imap, imaps, pop3, pop3s), invoke:
nail -f pop3://email@example.com nail -f imaps://firstname.lastname@example.org
However, fetchmail/procmail would do better job for automated e-mail receiving. This is how this chain can co-work:
Mail Transport Agent (fetchmail) -> Mail Delivery Agent (procmail) -> Mail User Agent (nail?)
When sending, nail can pass the message to sendmail for further delivery (this option is not compiled in OpenSlug-2.6 and earlier) or use SMTP protocol to contact directly the recipient's mail server.
I made a .mailrc file in home directory (every user wishing to use nail has to create his/her own .mailrc configuration file) containing just two lines:
set smtp=smtp-server.my.isp.com set email@example.com
After that I can send automated messages from the command line or via script.
> some_script.sh | nail -s "Script output" firstname.lastname@example.org