Can not attach using mailx

hi

I know this topic has been discussed a lot in the forum but still couldnt get a exact solution to problem i am facing

I have a CSV file genertaed on Unix box and want to be sent to my email .

mailx -s "TEST" "xyz@hotmail.com" < 1.csv
cat 1.csv | mailx -s "TEST" "xyz@hotmail.com"

I am getting the mail , but the contents of attcahment are on the bodu of mail .
I want the mail with 1.csv as attachment

Pls advise .

Thanks

uuencode 1.csv 1.csv | mailx -s "TEST" "xyz@hotmail.com"

Thanks mate .. u made my evening :stuck_out_tongue:

---------- Post updated at 08:31 PM ---------- Previous update was at 07:53 AM ----------

Any ideas as to how do i add a body to this messsgae ..

Thanks

uuencode xyz.csv xyz.csv | mailx -s "Subject" "abc@yahoo.com"

As usual, it always helps to know what Operating System you are using today.

Here is a broad solution for most modern unixes: Adjust for your local syntax.

(cat mailbody.txt ; ux2dos xyz.csv | uuencode xyz.csv ) | mailx -m -s "Subject" "abc@yahoo.com"

I am using Sun Solaris ..

Tried this .. not working ...

(cat mailbody.txt) ; uuencode 12-MAY-10.csv uuencode 12-MAY-10.csv | mailx -s "Explained" "ultimatix@hotmail.com"

No ux2dos on my system

The parentheses allow us to execute a sequence of unix commands separated by ";" , then present the whole output to "mailx".
The position of the parentheses is critical.
Also you have the word "uuencode" in the line twice.

The equivalent of "ux2dos" appears to be "unix2dos" on Solaris.
You've removed the "-m" switch from the "mailx". I assume that it is not valid on your Solaris. I'd like to check but the website docs.sun.com has collapsed in a heap today.

(cat mailbody.txt ; unix2dos 12-MAY-10.csv | uuencode 12-MAY-10.csv) | mailx -s "Explained" "ultimatix@hotmail.com"

Hi Methyl

It worked perfect . Mial delivedred with attachment but got this error mesg on terminal

Can this be suppressed .. I am using Ksh

could not open /dev/kbd to get keyboard type US keyboard assumed
could not get keyboard type US keyboard assumed

just redirect stderr to dev null

(cat mailbody.txt ; unix2dos 12-MAY-10.csv | uuencode 12-MAY-10.csv) | mailx -s "Explained" "ultimatix@hotmail.com" 2> /dev/null

Yes mate , I did try that

Its not getting redirected to /dev/null ...

and getting displayed on terminal ..

Any ideas for thies weird behaviour

Though I have no personal experience of this error, googling the error message turned up this post:

http://www.unix.com/unix-dummies-questions-answers/27088-error-could-not-open-dev-kbd-get-keyboard.html

Great , it worked ...

(cat mailbody.txt ; unix2dos -437 12-MAY-10.csv | uuencode 12-MAY-10.csv) | mailx -s "Explained" "ultimatix@hotmail.com

"