Mail command help

I want to send file data not attachment through email in unix tried
below line

file=t.txt

mail -s "INPUT DATA" "kali@gmail.com" <<eof
HI Team

Please find the below details

echo `$file'

Thanks
eof

t.txt

Account Country of Issue 
Security ID  NAME 123 24455 78900 
Security ID 23354 55667 9009000 990010
NAME ID999 990020  899040 999002

while using this command it is not display line by line it display in single line in the text meassage

Might be a problem with your outlook mail client.

EDIT: And, I'm pretty sure your echo command won't work. Try cat $file .

is it correct or any other way we can send plz sugest

All echo will do is display the content of the variable, here : t.txt
as RudiC mentionned if you want the content of the t.txt then its cat you should use...

I'm not sure this will work for several reasons, not least:-

  • You have mis-matched quotes on the echo command.
  • The content of the here document (between <<eof and eof ) is not executed.

You should get away with variables being interpreted, so perhaps this would work:-

file=t.txt
file_content=$(cat $file)

mail -s "INPUT DATA" "kali@gmail.com" <<eof
HI Team

Please find the below details

$file_content

Thanks
eof

Does that help? It's probably not the best way to do this but it might work.

Robin

working file but the content are nor display in the text mail

What about showing us what you get, that could help us understand and figure out