使用 "cmd = echo ..." 发送多个附件

sent multiple attachements with "cmd = echo ..."

我使用以下代码从 linux 发送邮件 - 我通常只附上一个文件,但想在编码中更改它以输入五个文件 - 知道怎么做吗?

body_text = "This is your Email Body"
title = "This is your Email title"
file = ('location/filename.txt')
cmd = 'echo "'+body_text+'" | mutt -s "'+title+'" -a '+file+' -- email@address.com'
subprocess.call(cmd,shell=True)

我浏览了很多网站,但其中 none 使用了我的代码。 谁能帮帮我?

当需要附加多个文件时,Mutt 需要多个 -a

https://superuser.com/questions/257963/using-mutt-to-send-2-files

body_text = "This is your Email Body"
title = "This is your Email title"
files = ('location/filename.txt', 'other file.txt')
cmd = 'echo "'+body_text+'" | mutt -s "'+title+ '" -a '.join(files) +' -- email@address.com'
subprocess.call(cmd,shell=True)