Tente isto:
mail -s 'Some Subject' -r 'First Last <[email protected]>' [email protected]
Isso define From:
e o remetente do envelope.
Como posso definir o nome do remetente e o endereço de e-mail usando o comando mail no shell script.
Tente isto:
mail -s 'Some Subject' -r 'First Last <[email protected]>' [email protected]
Isso define From:
e o remetente do envelope.
A opção -a
preenche o cabeçalho.
comando rápido:
mail -a FROM:[email protected] [email protected]
comando longo
mail --append="FROM:[email protected]" [email protected]
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
Common options
--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
Global debugging settings
--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
Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options.
Isso depende de qual cliente de e-mail você está usando. Algumas distribuições do Linux linkam para mailx
, onde você pode usar o parâmetro -r from-addr
.
Se você tem o mutt, você deve usar mutt -e "set from='name <name@somewhere>'>
.
Outras distribuições que possuem o comando mail
devem poder usar echo "test"|mail -s "subject" [email protected] -- -f from@address
.
Tags linux mail-command