Send attachment using mutt

Posted on July 26, 2011, 8:23 PM

Update [7/27/2011]: It doesn't work well with file containing texts (i.e. .cpp files). When I send a code or a data file, the file I received in the Attachment folder has texts all messed up.

I'm trying to use gnuplot to generate plots when I'm working on the cluster.  While both my laptop and PC at the office are Window OS, the most common way is to use file transfer software such as WinSCP. Although WinSCP is pretty handy to use, it is sometimes a pain in the ass to progress through many sub folders and then download it to the correct place on the Windows machine.

Most of the times the plot downloaded goes directly onto a powerpoint slide where I share my progress with my advisor through dropbox.  So I came up with this idea: Send the image as attachment to dropbox! This requires you to have a dropbox account and a email software installed on the remote linux machine.

I use mutt to send the attachment to my dropbox folder.  Dropbox has this function called: Send to dropbox. You'll be able to create an email address that will link to a folder called "Attachment".  Once you set up this "send to dropbox", the Attachment folder will be created. Below is a short script to send a file to my dropbox:

This script takes one argument: The path to the file you want to transfer to your dropbox ($1). It usually takes about 30 seconds until dropbox receives the file.  The time for using WinSCP and using this script are pretty much the same.  I'm happy about this script simply because it allows me not to move my hand over to the mouse.  After all, I'm more a key-board person.