How can you generate a dynamic "Reply-To:" (and "From:") header in emacs/gnus based on Message-ID of the created message? I would like to use external (perl) script to generate a dynamic +detail
part based on the "Messaged-ID:" header.
user+detail@example.net
I have managed to create a header with content generated by my external script. The script gets usenet group name as command line parameter. I would like to pass it the message-id value too.
My current code
~/.emacs :
'(gnus-posting-styles ("^pl\\.test$" ("Reply-To" message-make-reply-to)))
~/.gnus
(defun message-make-reply-to()
(my-script ".../reply-to.pl" (message-fetch-field "Message-Id")))
(defun my-script(path &optional param) ....
The problem: the script does not receive message-id as its parameter (my-script gets correctly explicitly set parameter)
Note the additional quote and parentheses around
message-make-reply-to
. The explanation for this is that the function is run at different times, depending on whether it's given as a symbol or as a quoted s-expression.message-setup-hook
. That happens in amessage-mode-hook
, i.e. right after the new buffer is created and switched intomessage-mode
. The cause for this is some wild quoting/unquoting of values during creation of the lambda function.Alternative Solution (without
gnus-posting-styles
)In cases where the new header should be added to every new message, the
Reply-To
header can also be set using themessage-header-setup-hook
. A custom hook needs to be defined to add the header for each new message.