Web*_*man 8 command-line shell mutt
目前我正在使用以下命令发送邮件:
mutt -s "Subject of Mail" test@example.com -a file -i bodyTextFile
Run Code Online (Sandbox Code Playgroud)
我的.muttrc
文件位于主目录中。
效果很好。
也就是说,我将直接发送文件,而无需在界面上确认收件人等元素。只需按照 shell 的指令完成这一切即可。
谢谢
通过 stdin 而不是通过-i
. mutt
当其标准输入不是终端设备时放弃交互模式,并像标准mailx
命令一样从那里获取电子邮件的正文。
mutt -s 'Subject of Mail' -a "$file1" -a "$file2" -- test@example.com < bodyTextFile\n
Run Code Online (Sandbox Code Playgroud)\n或者:
\nmutt -s 'Subject of Mail' -a"$file1" -a"$file2" -- test@example.com < bodyTextFile\n
Run Code Online (Sandbox Code Playgroud)\n请注意,--
只要您使用 , 标记选项结尾就是必需的-a
,即使您将其写mutt -afile -s subject -- address
在没有它的地方,它仍然要添加address
为第二个附件。
你还可以这样做:
\nmutt -s 'Subject of Mail' -a "$file1" "$file2" -- test@example.com < bodyTextFile\n
Run Code Online (Sandbox Code Playgroud)\n如帮助信息所示:
\n$ mutt -h\n -a <file> [...] -- attach file(s) to the message\n the list of files must be terminated with the "--" sequence\n
Run Code Online (Sandbox Code Playgroud)\n$file2
但如果从 开始,这将无法正常工作-
,因此最好避免这样做。
如果您有一个$list
包含附件列表的数组,则可以使用-a$list
in rc
\xc2\xb9 / es
/fish
或inzsh -o rcexpandparam
或in /或in 。-a$^list
zsh
"${list[@]/#/-a}"
bash
zsh
"${list[@]/*/-a\\0}"
ksh93
\xc2\xb9 不$list
存在时可能为空rc