>>>>> "Sam" == Sam Steingold <[EMAIL PROTECTED]> writes: Sam> Sam> Sometimes I get a message from a mailing list with a From address like Sam> this: Sam> "John Doe via RT <[EMAIL PROTECTED]>" Sam> Sam> I added a variable `bbdb-canonicalize-name-hook', similar to Sam> `bbdb-canonicalize-net-hook', and I set it like this: Sam> Sam> (setq bbdb-canonicalize-name-hook Sam> (lambda (name) Sam> (when name Sam> (cond ((string-match " via$" name) nil) Sam> (name)))))
where do you call this? Sam> is there a better solution? well I certainly don't have a better one but a different one. I had the same problem quite some time ago. I receive quite a few emails with "commented" email addresses like "via the vacation program", "via HyperNews" etc. I came up with the following solution: (defadvice mail-extract-address-components (after via activate) "If FULL-NAME contains the word \"via\", strip that phrase." (let ((full-name (car ad-return-value)) discard-position) (when (and full-name (string-match "\\<via\\>" full-name)) (setq discard-position (match-beginning 0)) ;; 1. FULL-NAME starts with "via" -> discard completely (if (zerop discard-position) (setcar ad-return-value nil) ;; 2. FULL-NAME contains "HyperNews" -> discard completely (if (string-match "HyperNews" full-name) (setcar ad-return-value nil) ;; else discard everything from " via" on (setcar ad-return-value (substring full-name 0 (1- discard-position)))))))) It'd be nice if mail-extract-address-components had a hook somewhere or some regexp check for parts of the email addr to discard. Maybe there even is a possibility, but this function is too complicate for me :-(. Klaus -- ------------------------------------------ | Klaus Zeitler Lucent Technologies | | Email: [EMAIL PROTECTED] | ------------------------------------------ --- The easiest way to figure the cost of living is to take your income and add ten percent. ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/