2015-01-20 3 views
0

이메일의 일부 텍스트를 파일의 내용과 함께 보내려면 파일을 첨부 파일로 보내지 않으시겠습니까? mailx 명령으로 가능합니까?mailx를 사용하여 파일을 텍스트로 보내고 이메일 본문에 추가 텍스트를 추가하는 방법은 무엇입니까?

mailx -s "Email log file" [email protected] <$log_file; 

$ LOG_FILE 내용이 이메일로 도착하지만, 아래에 이메일

echo "Comment: log contains last month report" | mailx -s "Email log file" [email protected] < $log_file 

필요한 출력을 작동하지 않습니다

여기
Comment: Log contains last month report 

<All contents of $LOG_FILE as text> 
+1

아마도 http://stackoverflow.com/questions/2282506/how-can-i-send-an-email-through-unix-mailx-command의 사본입니다. 적어도 그 링크는 질문에 대답합니다. – mpez0

+0

감사합니다. – homer

답변

0

당신은 어떻게 할 것입니다 :

echo "Comment: log contains last month report\n $(cat \$log_file)" | mailx -s "Email log file" [email protected] 

"웃기는"유일한 것 파일 이름에서 $를 벗어나야합니다. 필요한 경우 더 많은 행을 추가 할 수도 있습니다.