Go to the first, previous, next, last section, table of contents.

Predefined Hooks

If the variable bbdb-change-hook is set to the symbol bbdb-timestamp-hook, then every record in the database will have a field named `timestamp', which will always contain the date and time at which this record was created or last modified.

If the variable bbdb/mail-auto-create-p is set to the symbol bbdb-ignore-most-messages-hook, then the variable bbdb-ignore-most-messages-alist will determine which messages should have records automatically created for them. The format of this alist is

(( HEADER-NAME . REGEXP ) ... )

for example,

(("From" . "@.*\\.maximegalon\\.edu")
 ("Subject" . "time travel"))

will cause BBDB entries to be made only for messages sent by people at Maximegalon U., or (that's or) people posting about time travel.

There may be only one entry per header in this alist: that is,

(("From" . "addr1\\|addr2") ... )

is legal, but

(("From" . "addr1") ("From" . "addr2") ... )

is not.

If the variable bbdb/mail-auto-create-p is set to the symbol bbdb-ignore-some-messages-hook, then the variable bbdb-ignore-some-messages-alist will determine which messages should have records automatically created for them. This is the exact inverse of the semantics of the bbdb-ignore-most-messages-alist: the alist specifies which messages should not have records automatically created for them, instead of which should. For example,

(("From" . "mailer.daemon")
 ("To" . "mailing-list-1\\|mailing-list-2")
 ("CC" . "mailing-list-1\\|mailing-list-2"))

will cause BBDB entries to not be made for messages from any mailer daemon, or messages sent to or CCed to either of two mailing lists.

The variable bbdb/news-auto-create-p may be set to either of the above-mentioned functions as well, to get this behavior for netnews messages instead of mail messages.

If the variable bbdb-notice-hook is set to the symbol bbdb-auto-notes-hook, then the variable bbdb-auto-notes-alist may be used to automatically add text to the notes fields of the records corresponding to certain messages. The format of this alist is

(( HEADER-NAME
   (REGEXP . STRING) ... )
    ... )

for example,

(("To" ("-vm@" . "VM mailing list"))
 ("Subject" ("sprocket" . "mail about sprockets")
            ("you bonehead" . "called me a bonehead")))

will cause the text "VM mailing list" to be added to the notes field of the record corresponding to anyone you get mail from via one of the VM mailing lists. If, that is, bbdb/mail-auto-create-p is set such that the record would have been created, or if the record already existed.

The format of elements of this list may also be

(REGEXP FIELD-NAME STRING)

meaning add the given string to the named field. The field-name may not be `name', `aka', `address', `phone', or `net' (builtin fields) but must be either `notes', `company', or the name of a user-defined note-field.

("pattern" . "string to add")

is equivalent to

("pattern" notes "string to add")

STRING can contain \& or \N escapes like in the function replace-match. For example, to automatically add the contents of the organization field of a message to the company field of a BBDB record, you can use this:

("Organization" (".*" company "\\&"))

(Note you need two \ to get a single \ into a lisp string literal.) If STRING is an integer N, the Nth matching subexpression is used, so the above example could be written more efficiently as

("Organization" (".*" company 0))

If multiple clauses match the message, all of the corresponding strings will be added.

This variable works for news as well. You might want to arrange for this to have a different value when in mail as when in news.

There may be only one entry per header in this alist: that is,

 (("Subject" ("\\bfoo\\b" . "Foo!!")
             ("bar" . "Bar!")))

will work, but

 (("Subject" ("\\bfoo\\b" . "Foo!!"))
  ("Subject" ("bar" . "Bar!")))

will not.

bbdb-auto-notes-ignore is an alist of headers and regexps to ignore in bbdb-auto-notes-hook. Each element looks like

(HEADER . REGEXP)

for example,

("Organization" . "^Gatewayed from\\|^Source only")

would exclude the phony Organization: headers in GNU mailing-lists gatewayed to the gnu.* newsgroups.


Go to the first, previous, next, last section, table of contents.