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?

miguelmorin
  • 1,907
  • 12
  • 33
  • Does the answer in this issue https://github.com/djcb/mu/issues/1401 solve your problem? Maybe you could answer your own question. – andrej May 18 '19 at 17:44

2 Answers2

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.

dfeich
  • 1,904
  • 18
  • 17
  • 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. – miguelmorin Sep 07 '20 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.

miguelmorin
  • 1,907
  • 12
  • 33
  • 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 Sep 03 '20 at 08:24
  • @dfeich Correct, could you write an answer with a reference and a code snippet? – miguelmorin Sep 04 '20 at 09:03
  • 1
    This apparently worked for me with mu 1.8.3 – khourhin Jul 22 '22 at 07:54