A year ago I tried a couple of different email senders because I wanted to simplify sending emails from the command line. There are a couple of tools for it, I tried (I don't remember exactly):

  • sendmail
  • mail
  • xmail
  • ssmtp
  • uuencode
  • some mime scripts I found on the web using mail, that handle attachments.
  • echo body text | mutt -s subject -a /etc/resolv.conf [other files] -- test@example.com

The issue of attaching a file was difficult, due to

  • encoding issues
  • mime types for binary files
  • attaching multiple files failed (no clear boundaries between them)
  • send text files as attachment, not in email body

but eventually it worked with mutt (with the command above). I would have preferred a method without the invocation of a big program, but I was fine with it.

At some point I stopped using it, because I always had to enter the email addresses by hand and I never remember them.

In order further facilitate command line sending,

is there an easy way to enable tab-completion for email addresses?

I guess there is some manual work involved, because I didn't find anything on the web. Building an email index (exported cvs from gmail) seems easy, but what if John Jerry uses jj44@example.com as his email address? It would be necessary to complete

  • Jo<tab>
  • Je<tab>
  • ex<tab> and
  • jj<tab>.

This must be somehow fed into the readline utility - I don't know if that's difficult, but I'm looking for an easy way, if there is one!


You can do this with the bash-completion package and some custom scripting. Mutt completion is enabled by default.

See the following tutorials for extending the bash-completion functionality:




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.