mailx change sender name

限于喜欢 提交于 2019-12-05 10:38:58

The correct syntax is:

mailx -s "some subject" my@email.com -- -r newmail@mail.com

The Usage info shows "[-- sendmail-options ...]" and since "-r" is a sendmail option, you need to use the double dashes first.

mailx -a 'From:name@your-domain.com' -s "Subject" my-best-friend@other-domain.com < text.txt

Tested with this and found to be working:

echo test | mailx -s "Mail Test" user@recipentdomain.com -- -f user@senderdomain.com

The double-dash before "-f" makes the mailx not to parse the -f, but only pass it to sendmail/postfix, which will then send with the "from" address mentioned.

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