Import mutt contacts into gmail

This is a quick hack to import all contacts from a mail_aliases file (as used by mutt) into gmail.

cat ~/.mail_aliases | egrep -v ^# | cut -d ' ' -f 3- | tr "<" "," | tr -d ">" > mail_alias.csv

After this editing, open the mail_alias.csv file, remove any blank lines and add name, email as the first line in the file.

Check the contents of the file, as there is no way to undo an import other than deleting all your contacts from gmail.

You may also want to trim out any old email addresses you don’t use anymore.

After this editing my file looked like this:


name, email
Joe Bloggs ,joe@example.com
Joe Bloggs ,joe@example.com
Joe Bloggs ,joe@example.com
...

Gmail was then able to import this file without any trouble at all.

Leave a Reply

Your email address will not be published. Required fields are marked *