单个邮件unix中带有多个附件的mutt命令 [英] mutt command with multiple attachments in single mail unix
问题描述
我的要求是将所有.csv文件附加到一个文件夹中,然后以一封邮件的形式发送.
My requirement is to attach all the .csv files in a folder and send them in a single mail.
这是尝试过的,
mutt -s "subject" -a *.csv -- abc@gmail.com < subject.txt
以上命令不起作用(无法识别多个文件)并抛出错误
The above command is not working (It's not recognizing multiple files) and throwing the error
Error sending message, child exited 67 (User unknown.).
Could not send the message.
然后我尝试如下使用多个-a
选项,
Then I tried using multiple -a
option as follows,
mutt -s "subject" -a aaa.csv -a bbb.csv -- abc@gmail.com < subject.txt
这可以按预期工作. 但这对于100个文件来说是不可行的.我应该可以将其与文件掩码一起使用(就像* .csv一样,以获取所有csv文件).有什么方法可以在单个命令中使用* .csv吗?
This works as expected. But this is not feasible for 100 files for example. I should be able use it with file mask (as like *.csv to take all csv files). Is there is any way we can use like *.csv in single command?
谢谢
推荐答案
Mutt不支持这种语法,但这并不意味着它是不可能的.您只需要构建mutt命令即可.
Mutt doesn't support such syntax, but it doesn't mean it's impossible. You just have to build the mutt command.
mutt -s "subject" $( printf -- '-a %q ' *.csv ) ...
$( ... )
中的命令产生如下内容:
The command in $( ... )
produces something like this:
-a aaa.csv -a bbb.csv -a ...
这篇关于单个邮件unix中带有多个附件的mutt命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!