2013-11-14 31 views

回答

0

這裏的文件沒有完成。

sendmail /A "/home/dd/data/list.txt" "[email protected]" -t << -EOF 
To:[email protected] 
Subject:List of ids 
This is the message 
EOF 

嘗試-EOF所以尾隨EOF不需要在最左邊的列中。

試試這個,我只是測試它:

/usr/sbin/sendmail -tv [email protected] <<%% 
Subject: test of sendmail 
This is the note 
$(uuencode attachment.file newname.txt) 
%% 

我沒有時間去回本。電子郵件地址的推移線1

+0

這是造成EOF出現在我的郵件正文。我曾嘗試過這個選項。但它無助於發送附件。 – NewQueries

+0

謝謝@jim。但是我收到了錯誤消息,並且發送了一封沒有附件的電子郵件。 uuencode:找不到[沒有這樣的文件或目錄] 但是當我做人uuencode時,我得到了它的手冊頁 – NewQueries

+0

然後在你的代碼/數據中有其他的東西導致一個問題 - 就像一個帶空格的文件名。 –

0

嘗試下面的腳本:

#!/bin/sh 
# send/include list.txt file after "here document" (email headers + start of email body) 
cat - "/home/dd/data/list.txt" | /usr/sbin/sendmail -i -- "[email protected]" <<END 
To: [email protected] 
Subject: List of ids 

This is the message 
END 
+0

我只是無意中編輯了你的答案。請忽略來自SO的說明。抱歉。 –