From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/15730 Path: news.gmane.org!not-for-mail From: Abramov Aleksey Newsgroups: gmane.emacs.gnus.user Subject: Replace, insert or append Bcc header based on Subject field. Date: Sun, 19 Aug 2012 21:35:34 +0400 Message-ID: <87a9xqwzrt.fsf@mmer.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345398012 25689 80.91.229.3 (19 Aug 2012 17:40:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Aug 2012 17:40:12 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Sun Aug 19 19:40:13 2012 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T39Tw-0002OZ-Vm for gegu-info-gnus-english@m.gmane.org; Sun, 19 Aug 2012 19:40:13 +0200 Original-Received: from localhost ([::1]:35684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T39Tv-0000OW-Li for gegu-info-gnus-english@m.gmane.org; Sun, 19 Aug 2012 13:40:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T39Tu-0000OR-AK for info-gnus-english@gnu.org; Sun, 19 Aug 2012 13:40:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T39Tt-000432-2h for info-gnus-english@gnu.org; Sun, 19 Aug 2012 13:40:10 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:47231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T39Ts-00041V-SM for info-gnus-english@gnu.org; Sun, 19 Aug 2012 13:40:09 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1T39Tn-0002Fy-NA for info-gnus-english@gnu.org; Sun, 19 Aug 2012 19:40:03 +0200 Original-Received: from 188.134.61.60 ([188.134.61.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Aug 2012 19:40:03 +0200 Original-Received: from levenson by 188.134.61.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Aug 2012 19:40:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 67 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 188.134.61.60 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) Cancel-Lock: sha1:2XbdOEnCdqLlU8GdNQm9hY0k2ag= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.gnus.user:15730 Archived-At: Hi everyone. I have problems with `gnus-posting-styles' matching. Please look what I need to do: 1. I always add Bcc to myself to build a nice threads in my email account. 2. We use OTRS system, so there are a lot of mail with Ticket#XXXX, when I reply on it I'd like to add an additional Bcc header to and send it to our OTRS system support@my.domain.com email account. 3. OTRS notification comes from another email, I have to replace it by previously mentioned support@my.domain.com email. So here is my `gnus-posting-styles'. As it mentioned in manual ,----[ (info "(gnus)Posting Styles") ] | Each style will be applicable if the first element | "matches", in some form or other. The entire alist will be iterated | over, from the beginning towards the end, and each match will be | applied, which means that attributes in later styles that match override | the same attributes in earlier matching styles. So `---- So it have to set bcc header for my first group match "^nnimap\\+aabramov", and after that additional bcc have to be join by header match. But mail-fetch-field returns nil, and bcc header contains "nil, .....". --8<---------------cut here---------------start------------->8--- (defun bbdb-full-address (mail) (let ((record (first (bbdb-search (bbdb-records) nil nil mail)))) (if (vectorp record) (format "%s <%s>" (bbdb-record-name record) (car (bbdb-record-mail record))) nil))) (setq gnus-posting-styles '((".*" (name "Abramov Aleksey") (address "levenson@mmer.org") (signature "Sincerely,\nAbramov Aleksey.")) ("^nnimap\\+aabramov" (name "Aleksey Abramov") (address "Aleksey Abramov ") (organization "Skytel") (bcc (bbdb-full-address "a.abramov@my.domain.ru")) (signature-file "~/emacs-config/mail-signature.work")) ("^nnimap\\+localhost" (address "alex@smart.my.domain.ru")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Header replacement ((header "From" "otrs@otrs.my.domain.ru") (to (bbdb-full-address "support@my.domain.ru"))) ((header "Subject" "Ticket#") (bcc (concat (gnus-with-article-buffer (mail-fetch-field "bcc" nil t)) " ," (bbdb-full-address "support@my.domain.ru")))))) --8<---------------cut here---------------end--------------->8--- Where is my mistake? Any suggestions are welcome. -- Sincerely, Abramov Aleksey.