[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Replace, insert or append Bcc header based on Subject field.
From: |
Abramov Aleksey |
Subject: |
Replace, insert or append Bcc header based on Subject field. |
Date: |
Sun, 19 Aug 2012 21:35:34 +0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) |
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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Replace, insert or append Bcc header based on Subject field.,
Abramov Aleksey <=