问题
I want to dynamically set the sender's address when using mutt via console (not composing). I checked everything which is described, tried everything from this SO question but nothing works. There is no change at all, no matter what I do. I set
set from="sender@help.me"
set edit_headers=yes
in both the /etc/Muttrc and ~/.muttrc, also, I tried all sort of -e commands, like
-e "set from=email@example.com"
-e 'my_hdr From:sender@help.me'
-e "send-hook . 'my_hdr From: Other Name <otheremail\@example.com>'"
having export EMAIL=sender@help.me in front
but I will always receive mails from username@compname.de
A typical call looks like this
export EMAIL="sender@help.me" && echo | mutt -s "VERSANDTEST" -c "mycc@help.me" -e 'my_hdr From:sender@help.me' -a /opt/data/YoloDat.txt /opt/data/TroloDat.txt -- "myaddress@help.me" < /tmp/mailbody
Any more ideas appreciated
回答1:
This works for me:
export EMAIL="Name <from@address.com>";
echo "Test message body" | mutt -s "Test Subject" -- to@address.com;
回答2:
Use set use_envelope_from = yes
in your .muttrc. This adds the -f option when calling sendmail to deliver the mail, forcing it to use the same address for the envelope as for the From: header field.
Setting set edit_headers = yes
in .muttrc was not required to use the my_hdr-Flag on the command line.
echo "Test" | mutt -e "my_hdr From:sender@domain.tld" -- receiver@domain.tld
来源:https://stackoverflow.com/questions/18446143/change-senders-address-in-mutt-via-console