简体   繁体   English

使用mailx发送邮件时的Output格式

[英]Output format when sending the mail using mailx

I have a summary file which needs to be displayed with formatting as it is in the OS to the mail.我有一个摘要文件,它需要在邮件的操作系统中以格式显示。

Summary.txt摘要.txt

@@@@@@@@@@@@@
Total files deleted: 55

@@@@@@@@@@@@@
Total Files fixed :77
Path :/tmp

But when mail is sent the formatting is lost ( i even tried cat -e)但是当发送邮件时,格式会丢失(我什至尝试过 cat -e)

@@@@@@@@@@@@@ Total files deleted: 55 @@@@@@@@@@@@@ Total Files fixed :77 Path :/tmp

Following is the code, can anyone help me to preserve the formatting以下是代码,谁能帮我保留格式

summary=`cat /tmp/Summary.txt`
body="Hi Team, \n\n Find below  summary . \n\n $summary \n\nRegards"
echo -e $body | mail -s "$SID: Job Report" -a $asummary -a $tsummary $mail

try this:尝试这个:

summary=`cat /tmp/Summary.txt`
echo -e "Hi Team,\n\nFind below summary .\n\n${summary}\n\nRegards" | \
mail -s "$SID:Job Report" -a $asummary -a $tsummary $mail

note: you can split a shell command over multiple lines by using \注意:您可以使用\将 shell 命令拆分为多行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM