Text File error in email

Hi,

 I am trying to send a csv and txt file as attachment from AIX using a script, csv file ssent out correctly but for txt the data comes in one line and it could not retain the same format data it ends up showing all the data in single line. It has these junk chars for new line...is there any way to remove these junk for new lines...

here is how I am sending the file...

uuencode test.txt Today_test.txt | mail -s "Today File" mail@id.com

is there any way to remove these junk chars...

Thanks,

If the csv comes from Winodws and the chars look like ^M in vi, then

dos2ux  test.txt > tmp.tmp
uuencode tmp.tmp Today_test.txt | mail -s 'file' you@some.com

dos2ux maybe called dos2unix on your box.

Perhaps check out other ways to do it:
http://www.unix.com/showthread.php?t=13766

That thread links to mimesender:

Even if you use the essential dos2unix command there is a possibility that text will come in one line.The solution is to open the file in notepad and do word wrap option.that will bring output in different lines.