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:<p><pre><code>    alias gm1='curl -u USERNAME:PASSWORD --silent "https://mail.google.com/mail/feed/atom" |
    tr -d '\''\n'\'' |
    awk -F '\''<entry>'\'' '\''{for (i=2; i<=NF; i++) {print $i}}'\'' |
    sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p" |
    sed '\''s/&lt;/>/g'\'' '
</code></pre>
<i>EDIT</i> and send mail by setting the headers (including <i>MAIL FROM:<USERNAME@gmail.com></i>) and body (using <i>uuencode</i> for attachments) in <i>email</i>, and then:<p><pre><code>    echo "$email" | netcat ISPs_MAILSERVER 25</code></pre>