[neomutt-users] Changing "from" based on message content

Sven Guckes neomutt-lists at guckes.net
Tue Apr 20 22:27:56 CEST 2021

* Currie <currie at cryptolab.net> [2021-04-20 12:18]:
> I receive emails from the form-filler service formspree.
> Basically people fill out a form on my website
> and its sent via formspree to my inbox.
> Anyways, these emails contain the persons email and name in
> the body. So i would like, when i open one of these emails,
> to have the `from` address set to the persons email so that
> when i reply, i am replying to the person, not to formspree.
> How would one implement this?

so basically you get an email that's all wrong -
and you want mutt to correct it automatically.
i would opt to *not* add code to correct this.
because then you add more and more code to adjust
for problems created elsewhere and maybe in
a way that is not a solution for everyone.

it is best to fix the problem
at its root, ie fix formspree.

workaround #1:
use a mail filter (procmail,sieve) to change
the the From: line of the incoming message
before it gets delivered to your mailbox.
then simply reply to it.

workaround #2:
use "set edit_headers", reply, and
then use the power of your $EDITOR
to adjust the TO/CC in your reply.

you could present an example and maybe
we will find a workaround for it together.
(in vim i'd map something like a function key
 to search for the email address in the body,
 copy it, and place it into the TO: line.)

> Ideally it would be something like this
> message-hook '~f .*@formspree.io' 'set from=`parsemessage <$MESSAGE`'

the ".*" would not be required as this is a submatch.
and you would send the reply in the TO/CC lines
rather than using is as your own sender address.


neomutt maillist reminder:
please do use neomutt to post
and sign your messages.  why?
because we can, right?!  :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1495 bytes
Desc: not available
URL: <https://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20210420/bf904035/attachment.sig>

More information about the neomutt-users mailing list