我使用以下代码从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)
我读了很多网站,但是没有一个使用我的代码。 谁能帮我吗?
答案 0 :(得分:1)
需要附加多个文件时,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)