E-mailing a binary e-mail attachment from a Linux server has always been difficult for me because I never found a reliable method to get it done. I’ve used uuencode to pipe data into mail on various systems but the attachment is often unreadable by many e-mail clients. Someone finally showed me a simple, fool-proof method to send binary attachments reliably from various Linux systems: echo "Cheeseburger" | mutt -s "OHAI!" -a lolcat.
Occasionally, I’ll end up with a mailbox full of random data, alerts, or other useless things. If you have SSH access to the server, you can always clear out your mail spool, but if you connect to an IMAP server, you can use mutt to do the same thing. First, use mutt to connect to your server remotely (via IMAP over SSL in this example): mutt -f imaps://mail.yourdomain.com/ Once you’ve connected and logged in, press SHIFT-D (uppercase d).