Change sender's address in mutt via console

隐身守侯 提交于 2019-12-12 02:25:54

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!