This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm not sure mail/mailx supports attachments. You may be better off using mutt or something like that.
The Internet email system was designed to be able to route mail through a variety of systems, including IBM mainframes (EBCDIC, not ASCII) and even some that had byte sizes other than 8 bits. Thus, a fundamental constraint was that all email context had to be representable using a basic 7-bit character set that could be freely translated between all these different platforms.
Your attempt to use uuencode is on the right track, but what you really want is MIME encoding. MIME encoding has 2 parts: 1), conversion to character-only format and 2) MIME encapsulation. MIME encapsulation is done by including a special header line in the email text that indicates that an attachment follows and what character sequence will be terminating it. It also tells what kind of data is in the attachment, such as text/html or image/jpeg.
For more on that topic, consult the Internet RFCs. But unless you really want to get into it, an attachment-friendly email app is probably a better choice.
An IDE is no substitute for an Intelligent Developer.