0
我想在linux命令行上生成串行郵件。假設我有一個文件,指出每個收件人的郵件地址,主題和消息文本分列在不同行上。即在linux命令行上創建串行郵件
[email protected] subject1 text1
[email protected] subject2 text2
...
腳本應該使用標準命令,因爲我打算將它發送給應該爲我創建一些電子郵件的同事。 線上的循環可以用xargs ...我可以使用命令行工具mail
?
郵件不立即發送很重要。理想情況下,它創建用於用戶首選郵件客戶端的文件。這樣發件人可以在提交郵件之前檢查郵件。 我也希望能夠將附件添加到郵件。
我試過
function mail_kmail {
kmail -s "$2" --body "$3" --attach "$4" --composer "$1"
}
function mail_thunderbird {
thunderbird -compose "to='$1',subject='$2',body='$3',attachment='$4'"
}
和讀取從文件輸入數據與
while read recipient subject body attach $file
do
mail_kmail "$recipient" "$subject" "$body" "$attach";
done
但前提是安裝在我的同事和設置這兩種郵件客戶端,這將工作。
我發現這個(關閉)相關問題: How can i send automated email in linux?。
查看它被關閉的原因。你有什麼嘗試? – Gryphius