Introducing Google Command line Tool
I use this to check my gmail from the command line (they don't include gmail in the examples). Ugly but fun:    alias gm1='curl -u USERNAME:PASSWORD --silent "https://mail.google.com/mail/feed/atom" |
    tr -d '\''\n'\'' |
    awk -F '\'''\'' '\''{for (i=2; i<=NF; i++) {print $i}}'\'' |
    sed -n "s/\(.*\)\(.*\).*/\2 - \1/p" |
    sed '\''s/&lt;/>/g'\'' '

EDIT and send mail by setting the headers (including MAIL FROM:) and body (using uuencode for attachments) in email, and then:    echo "$email" | netcat ISPs_MAILSERVER 25