Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
#!/usr/bin/env ruby
# gem install pony
require 'pony'
if ARGV[0]
my_filename = ARGV[0]
my_email = `git config --global`
Pony.mail(to: my_email, from:my_email, subject: "Mailing Myself a File", body: "ohai, yes this is a file you sent yourself just now.", attachments: {my_filename =>})
puts "please provide as a single argument the name of the file to send to yourself"

MailMe is a super short ruby script that uses pony to send yourself a file from the computer you're on.


git clone ~/mailme
gem install pony
cd ~/mailme
ln -s $PWD/mailme /usr/local/bin/

The mailme script is stored in the file ~/mailme/mailme, and symlinked to your /usr/local/bin/. After restarting your terminal, the command mailme will be available.



  • The "me" is gleaned from your git config --global
  • The file that is sent is provided as the first argument to the command.
  • Warning: mail sent from the local computer via pony is often caught in a spam filter, make sure the message actually arrives in your inbox.

This comment has been minimized.


This comment has been minimized.

Copy link
Owner Author

@caseywatts caseywatts commented Feb 9, 2015

The user interface I really want is mailme FILENAME.

I can imagine rewriting this to use mail and remove the ruby dependency and that'd be great! But I've got a stumbling point.

OS X doesn't come with the command line utility mutt (a MIME utility needed to do attachments with mail). pony brings in a ruby MIME package and uses it in conjunction with mail. Right now I suspect the ruby dependency is more lightweight than one would be on mutt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment