Richard Riley <[email protected]> writes:
> I was wondering if anyone has a solution for setting the
> gnus-posting-style address based on a "email-from" field or similar on a
> contacts bbdb record?
Put the following function in your .gnus:
(defun DE-bbdb-match-field-recipient (field regexp)
"Match FIELD for recipient against REGEXP.
FIELD must be a symbol, e.g. 'gnus-private."
(let (who rec)
(when (and
(gnus-buffer-live-p gnus-article-copy)
(setq who
(with-current-buffer gnus-article-copy
(save-restriction
(nnheader-narrow-to-headers)
(or (message-fetch-field "reply-to")
(message-fetch-field "from")))))
(setq rec
(bbdb-search-simple
nil
(cadr (gnus-extract-address-components who)))))
(string-match regexp (bbdb-get-field rec field)))))
Then you can use this function in gnus-posting-styles as follows:
(setq gnus-posting-styles
'(
((DE-bbdb-match-field-recipient 'gnus-private "work")
(signature-file "~/work-sig.txt")
(address "addr...@work"))
((DE-bbdb-match-field-recipient 'gnus-private "other")
(signature-file "~/other-sig.txt")
(address "addr...@other"))
;; default rule
((DE-bbdb-match-field-recipient 'gnus-private "")
(address "addr...@default"))))
I use the 'gnus-private field, since I also do mail splitting via BBDB,
but you can use any field you want, of course.
-David
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english