3

I use mu4e to read and write email. One email address that was in the LDAP server before no longer exists, but it still shows and auto-completes in mu4e.

How can I remove that address from the local database? And where is that database stored?

1

2 Answers 2

3

For mu version > 1.3.2. you need to define a filtering function and store its name in mu4e-contact-process-function, e.g. like in this example

(defun my-mu4e-contact-filter-function (addr)
  (if (string-match-p
        (concat "\\(?:no-?reply\\|.*\\.unwanted\\.domain\\.com\\|"
        "unwanted\\.user@somedomain\\.com\\)")
        addr)
     nil
  addr))
(setq mu4e-contact-process-function 'my-mu4e-contact-filter-function)

Note that the contact list only seems to get renewed when mu4e is started. So you will need to stop/restart mu4e upon changes.

1
  • I confirm that this works as of mu4e 1.14.13. I couldn't find how to stop and restart mu4e, so I restarted Emacs.
    – emonigma
    Commented Sep 7, 2020 at 10:27
1

Following the GitHub issue, one solution is to ignore that address in address completion. Add this code in ~/.emacs:

(setq mu4e-compose-complete-ignore-address-regexp
      (concat "\\(?:no-?reply\\|.*\\.unwanted\\.domain\\.com\\|"
              "unwanted.email@domain\\.com\\)"))

and notice the escaping of periods with (\\.). Then restart mu4e.

The database of contacts will be stored in the Xapian database starting with mu4e 1.4.

3
  • 2
    Note for others finding this answer: mu4e-compose-complete-ignore-address-regexp has been obsoleted since mu 1.3.2. You need now to define the name of a filtering function in the variable mu4e-contact-process-function.
    – dfeich
    Commented Sep 3, 2020 at 8:24
  • @dfeich Correct, could you write an answer with a reference and a code snippet?
    – emonigma
    Commented Sep 4, 2020 at 9:03
  • 1
    This apparently worked for me with mu 1.8.3
    – khourhin
    Commented Jul 22, 2022 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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