Linux
在郵件功能中設置發件人姓名
如何在 shell 腳本中使用 mail 命令設置發件人姓名和電子郵件地址。
試試這個:
mail -s 'Some Subject' -r 'First Last <you@example.com>' recipient@example.net
這將設置
From:
和信封發件人。
該選項
-a
填充標題。快速命令:
mail -a FROM:sender@my-domain.com recipient@another-domain.fr
長命令
mail --append="FROM:sender@my-domain.com" recipient@another-domain.fr
Usage: mail [OPTION...] [address...] -a, --append=HEADER: VALUE append given header to the message being sent -A, --attach=FILE attach FILE --content-type=TYPE set content type for subsequent --attach options -e, --exist return true if mail exists --encoding=NAME set encoding for subsequent --attach options -E, --exec=COMMAND execute COMMAND -F, --byname save messages according to sender -H, --headers write a header summary and exit -i, --ignore ignore interrupts -n, --norc do not read the system mailrc file -N, --nosum do not display initial header summary -p, --print, --read print all mail to standard output -q, --quit cause interrupts to terminate program -r, --return-address=ADDRESS use address as the return address when sending mail -s, --subject=SUBJ send a message with the given SUBJECT -t, --to precede message by a list of addresses -u, --user=USER operate on USER's mailbox
常用選項
--config-file=FILE, --rcfile=FILE load this configuration file --config-help show configuration file summary --config-lint, --rcfile-lint check configuration file syntax and exit --config-verbose, --rcfile-verbose verbosely log parsing of the configuration files --no-site-config, --no-site-rcfile do not load site configuration file --no-user-config, --no-user-rcfile do not load user configuration file --set=PARAM=VALUE set configuration parameter --show-config-options show compilation options
全域調試設置
--debug-level=LEVEL set Mailutils debugging level --debug-line-info show source info with debugging messages -?, --help give this help list --usage give a short usage message -V, --version print program version
長選項的強製或可選參數對於任何相應的短選項也是強製或可選的。