1
我試圖通過電子郵件發送日誌文件的內容是這樣的:發送日誌文件內容 - 郵件是空
sendmail -f [email protected] [email protected] < /private/var/log/mylog
不幸的是,這並不工作 - 電子郵件到達收件箱但是是空的。
同樣是真實的這種變化:
echo "$(</private/var/log/mylog)" | sendmail -f [email protected] [email protected]
但呼應一些字符串這樣的時候:
echo "testing" | sendmail -f [email protected] [email protected]
的電子郵件內容到達。另外,使用cat
查看文件的內容也起作用。這使我得出的結論必須是我編寫命令的方式,但我沒有看到任何語法問題或類似問題。
我錯過了什麼 - 爲什麼電子郵件在嘗試發送文件內容時空白?
命令可能是因爲郵件主體的限制,只要你的日誌文件大於幾兆更大。試試這個http://stackoverflow.com/questions/1333097/how-to-send-a-html-email-with-the-bash-command-sendmail –