## -*- coding: utf-8;mode: org; -*- ## Time-stamp: <2016-08-29 18:13:55 karl.voit> ## This file is best viewed with GNU Emacs Org-mode: http://orgmode.org/
This script is using Emacs Org-mode Org-contacts together with the MUA mutt.
Let’s take a look at an example Org-contacts entry which looks like that:
** Bob Simpson :research:chi09:BobSimpson: :PROPERTIES: :TYPE: :TITLE: Dr. :EMAIL: Bob.Simpson@example.com :oldEMAIL: Bob.Simpson@outdated.example.com :URL: http://example.com/bob :MOBILE: :HOMEPHONE: :WORKPHONE: :PHONE: :COMPANY: This cool research company :STREET: 42 Weirdstreet :POSTALCODE: 12345 :CITY: Denver :COUNTRY: USA :PHOTOGRAPH: [[photo:BobSimpson.jpg]] :BORN: 1970-12-31 :ITOLDTHEM_EMAIL: chi09@MY-DOMAIN.at :ITOLDTHEM_ADDRESS: :ITOLDTHEM_PHONE: :ADDRESS_CHANGE_METHOD: email :CREATED: [2015-01-30 Fri 17:51] :END:
:
- first contact: CHI conference 2009 - we had a nice lunch time together
Whenever I write an email to Bob (property :EMAIL:
), I would like to
use chi09@MY-DOMAIN.at
(property :ITOLDTHEM_EMAIL:
) instead of my
standard email address.
This way, I can give away contact-specific email addresses. That’s quite handy when you’ve got a catch-all email domain or you are using some more or less hidden features of cloud-based email services.
Using mutt as email client, you can define your own editor. For me, I
like to compose emails using gVim. Therefore, my .mutt
config file
usually contains the line:
set editor=vim
If you replace this line by …
set editor="/usr/bin/python3 /home/USER/bin/muttfilter.py"
… you can use this script as a wrapper function. It parses your
Org-mode file for contacts, extracts their email addresses, and your
corresponding from-addresses. It compares the first from-address
from your current email and does a look-up. If it finds a
corresponding pair of entries in your Org-contacts file, the
FROM:
-address gets replaced by the address of your choice.
After this, the gVim editor is opened to let you compose your email as usual.
For debugging purposes, a log-file gets written to LOGFILENAME
(see
code!) which is removed when no error occured. Please modify its path
if you got security concerns about that.
You might also take a look at following variables and adapt them to your requirements:
TMPFILENAME
: path to temporary fileORGCONTACTSFILE
: path to your Org-mode file containing the org-contacts-entriesDEFAULT_EMAIL_ADDRESS
: your default email addressEDITOR
: your default editor
I’m glad you like my tools. If you want to support me:
- Send old-fashioned postcard per snailmail - I love personal feedback!
- see my address
- Send feature wishes or improvements as an issue on GitHub
- Create issues on GitHub for bugs
- Contribute merge requests for bug fixes
- Check out my other cool projects on GitHub