Yes Email is a File Transfer Protocol

August 17th, 2009

As much as it wasn't designed as one, the convenience of email has led to its widespread use as a file transfer protocol.

I'm currently evaluating ways to leverage this fact more effectively (such as for blog posting), but in the meantime, I've found this little shell command to be very handy as a quick backup for text files:

cat test.rb | /usr/sbin/sendmail -t

It won't work for binary files; those require base64 encoding and attachment with mime data.

This page from shelldorado is awesome:

Sending e-mail using shell scripts

Yes, metasend from the metamail package (available on debian) works perfectly:

metasend -b -t -s "Testing metasend" -m image/jpeg -f kilotronix_1.jpg-thumb-210x109-1709.jpg

To get the filename on the receiving side, I'm using the -D flag to set the content-description header.

metasend -b -t -e base64 -s "Testing metasend" -m image/jpeg -D kilotronix_1.jpg-thumb-210x109-1709.jpg -f kilotronix_1.jpg-thumb-210x109-1709.jpg -n -m text/plain -f blah
Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022