script that will send and email attachment

I'm looking for a sample of some code that will take the output from a file and generate an email that will include that text as an attachment. the script is in the borne shell. any help?

uuencode x.txt x.txt | mailx X@Y.com

This is a very common question that has been asked many times in these forums. In fact there is a FAQ entry for it. Also a quick search of the forums gives a lot of results.

Cheers
ZB