Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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:

http://www.linuxjournal.com/content/more-using-bash-complete-command

http://www.debian-administration.org/articles/316

http://www.debian-administration.org/article/An_introduction_to_bash_completion_part_2

share|improve this answer
    
thanks for the answer, I see that a lot of reading is ahead of me ;-). cheers. –  Sebastian May 8 '11 at 19:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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