8

I am using BBDB3 with Gnus. I want to make BBDB to update the recipient address in its database for each mail I send (just like Gmail does). Is it possible?

paprika
  • 1,944
  • 19
  • 26
kindahero
  • 528
  • 4
  • 11

2 Answers2

5

Certainly, this is Emacs ! :)

(bbdb-initialize 'gnus 'message)
(bbdb-mua-auto-update-init 'message) ;; use 'gnus for incoming messages too
(setq bbdb-mua-auto-update-p 'query) ;; or 'create to create without asking

This will parse fields in outgoing messages, and suggest creation of corresponding BBDB entries

Sigma
  • 4,510
  • 21
  • 27
  • 1
    That makes it too intrusive especially while reading a news group. I don't want bbdb act on incoming messages but for only messages that I send. Looking for some kind of `message-sent-hook`? – kindahero Sep 24 '14 at 14:02
  • well that's the reason why I did write `(bbdb-mua-auto-update-init 'message)` and not `(bbdb-mua-auto-update-init 'message 'gnus)`. The former hooks into `message-send-hook` (only outgoing messages), while the latter hooks also into `gnus-article-prepare-hook` (all displayed articles, hence incoming ones too) – Sigma Sep 24 '14 at 14:06
  • 1
    Thanks for explaining. But it doesn't seem to work. don't know why. I will test more and come back. – kindahero Sep 24 '14 at 14:21
  • I suggest you double-check the content of `gnus-article-prepare-hook` and eliminate any occurrence of `bbdb-mua-auto-update` (they might come from other parts of your config, most likely another call to `bbdb-mua-auto-update-init`) – Sigma Sep 24 '14 at 15:34
2

I don't have automatic but if you wanted to have it in a quick one key here how you can have that :

(defun my-gnus-bbdb-snarf-sender ()
  (interactive)
  (gnus-with-article-buffer
    (let ((from (mail-fetch-field "from")))
      (bbdb-snarf from 'mail))))

and add in a hook for gnus-summary-hook to a key, like for example :

(defun my-gnus-summary-mode-hook ()
  (local-set-key '[(\')] 'my-gnus-bbdb-snarf-sender))
(add-hook 'gnus-summary-mode-hook 'my-gnus-summary-mode-hook)

which bind it to the quote ' keyboard to add the sender directly to BBDB