emacs-notmuch: Set variables based on From when composing
Thomas Schneider
qsx at chaotikum.eu
Sat Mar 17 11:11:39 PDT 2018
David Bremner <david at tethera.net> writes:
> Thomas Schneider <qsx at chaotikum.eu> writes:
>
>> Hello list,
>>
>> I use notmuch with the Emacs frontend and multiple accounts. I’d like
>> it to set the domain part of Message-Id header of any mail I compose to
>> something sensible, e.g. the FQDN of the host (which does not seem to be
>> easy, see [0]) or the domain part of the From header.
>
> There is some discussion on the wiki of using gnus-alias and
> message-templ with notmuch. The latter is more about setting headers.
Thanks for the pointer. gnus-alias seems to work so far. I also use it
to set the Fcc header to avoid duplicating address matches.
>>> I was thinking about setting message-user-fqdn based on the From header
>> in an appropriate hook, but I haven’t found yet where and how to do
>> this.
>
> There is notmuch-mua-send-hook (which by default just runs
> message-send-hook)
This seems to be run too late, so as for now, I use message-setup-hook
and always define the address I want to send as beforehand.
---
(add-hook 'message-setup-hook
(lambda ()
(make-local-variable 'message-user-fqdn)
(setq message-user-fqdn
(car (reverse (split-string
(car (mail-header-parse-address
(message-field-value "From")))
"@"))))))
---
Maybe I could add Message-ID to one of the headers added beforehand so
that I see what is generated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20180317/0f93b527/attachment.sig>
More information about the notmuch
mailing list