On Sat, 27 Mar 2010 21:13:36 +0100 Eraldo Helal <era...@eraldo.org> wrote: 

EH> auto-create on sending (only)
EH> ------------------------------
EH> Just as it is the case in gmail, I want to add to bbdb every contact I
EH> send an email to.
EH> When receiving mail, I want to only update the contacts in case of
EH> changed alias/etc.
EH> Any feedback on:
EH> - how to get there? =]
EH> - why that is a bad idea
EH> - any better idea?

Assuming you use message.el to compose mail:

This works for me.  You should look on the Emacs Wiki for ideas and
answers too, I think there's a pretty good collection of BBDB tips.

Ted

;;; from Michael R. Wolf <michaelrunningw...@att.net>
;;; TODO -- remove the mapconcat addition of commas, that get removed by m-t-h
(defun wolf3-bbdb-add-recipients-to-bbdb ()
  "Add all recipients to BBDB, using this list of headers:
        from, sender,
        to, cc, bcc,
        resent-from, resent-to, resent-cc, resent-bcc."
  (let ((fields '("from" "sender"
                  "to" "cc" "bcc"
                  "resent-from" "resent-to" "resent-cc" "resent-bcc")))
    (mapc
     (lambda (address)
       (bbdb-annotate-message-sender address t t t))
     (save-restriction
       (message-narrow-to-headers)
       (message-tokenize-header (mapconcat 'message-fetch-field fields ","))))))

;;; Could go into many hooks:
;;;        message-send-mail-hook
;;;        message-send-news-hook
;;;        message-send-hook
;;;        message-sent-hook
(add-hook 'message-send-hook 'wolf3-bbdb-add-recipients-to-bbdb)


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to