Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Replace, insert or append Bcc header based on Subject field.
@ 2012-08-19 17:35 Abramov Aleksey
  0 siblings, 0 replies; 3+ messages in thread
From: Abramov Aleksey @ 2012-08-19 17:35 UTC (permalink / raw)
  To: info-gnus-english


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 <a.abramov@my.domain.ru>")
	 (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.

^ permalink raw reply	[flat|nested] 3+ messages in thread
[parent not found: <mailman.7249.1345398011.855.info-gnus-english@gnu.org>]

end of thread, other threads:[~2012-09-11 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-19 17:35 Replace, insert or append Bcc header based on Subject field Abramov Aleksey
     [not found] <mailman.7249.1345398011.855.info-gnus-english@gnu.org>
2012-09-05 14:16 ` Lars Ingebrigtsen
     [not found] ` <mailman.8108.1346854652.855.info-gnus-english@gnu.org>
2012-09-11 16:44   ` Abramov Aleksey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).