check my
1common lisp/0mail-demon.lisp

Here is the usage of a lisp wrapper I wrote
for BSD mail. Basically I'm letting BSD mail
have all the features and do all the work of
being a serious mail client, but getting its
output as strings from a lisp repl.
If you wanted to use it like I do, you need
to put your ssh public key in 
~/.ssh/authorized_keys
on your sdf, and customize the username in
mail-demon.lisp.

Let's start using it;
'''
rlwrap ecl --load mail-demon.lisp
'''
rlwrap gives us command line niceties.
Enter the mail-demon package
'''
(in-package mail-demon)
'''
And check out mail. It returns a list,
so let's store that.
'''
(get-my-mail)
'''
This returns the first "page" of emails like
> (({>N 1 SCREWTAPE@SDF.ORG "long date and \"topic string\""))
Hey, it works for me.
'''
(setq *email-string* (get-message 1))
'''
Does something obvious,
'''
(dq-mail 1 2)
'''
is equivalent to
'''
mail 
d 1 2
x
'''
And mailing gave me some trouble actually, since I couldn't
figure out getting mail -I to play nice, so I just make a
clumsy system call (and substitute away backticks).
'''
(send-mail 'screwtape@sdf.org "a topic" #p"path/to/text.file")
'''
} Everything is done via the ssh user at the top of 
mail-demon.lisp