Kalia
December 1, 2017, 9:33am
1
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
RudiC
December 1, 2017, 9:41am
2
Might be a problem with your outlook mail client.
EDIT: And, I'm pretty sure your echo
command won't work. Try cat $file
.
Kalia
December 1, 2017, 9:45am
3
is it correct or any other way we can send plz sugest
vbe
December 1, 2017, 9:53am
4
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...
rbatte1
December 1, 2017, 10:01am
5
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
Kalia
December 1, 2017, 10:27am
6
working file but the content are nor display in the text mail
vbe
December 1, 2017, 1:25pm
7
What about showing us what you get, that could help us understand and figure out