Problem while displaying(cat) file content inside telnet loop .

Hi Team,

Not getting the file output inside my email which i am sending from unix box. . Please refer the below code :

#!/bin/sh

  {
sleep 5
echo ehlo 10.56.185.13
sleep 3
echo mail from: oraairtel@CNDBMUREAPZP02.localdomain
sleep 3
echo rcpt to: saurabhtripathi@anniksystems.com
sleep 5
echo DATA
echo Subject: Alert !!! Back up Failed
echo ""
echo "Hello Team,"
sleep 1s
echo ""
sleep 1s
echo "Alert Back up failed . Please check !"
sleep 1s
echo ""
cat BHARTI_INDIA_EOD.log
sleep 1s
echo "Cheers"
echo ""
echo .
sleep 5
echo quit
} | telnet 10.56.131.8 25

output :

Hello Team,

Alert Back up failed . Please check !
Cheers.

Expected output -----------------------------

Hello Team,

Alert Back up failed . Please check !

(Here cat the output file)

Cheers.

I am using Red Hat Enterprise Linux Server release 6.6 .

Thanks

With RH6 use mailx -a "filename" to attach a file.

echo "Fixed text I want to say
More text
More text" > msg.txt
cat errorfilename >>msg.txt
mailx -s 'Subject goes here' -a "msg.txt"   name@mycompany.com

Trying to d use the smtp protocol directly means you have to follow it scupulously - try the above approach first.