Hours upon hours of Googling and testing later, I finally discovered that if I used MAILX instead of MAIL, my original coding worked! All customers seem to be happy now.
I've got no idea what the difference is, but there must be something special there
well well well I had no idea the "uuencode" function existed... good to know!
as to your encoding problem, the most thorough way to troubleshoot would be to compare emails that work and don't work, and see what the difference is. You may need to use a hex view to spot subtle problems.
It would not surprise me if it requires a particular kind of linefeed in the email in general, or in the block of uuencoded text.
apple:~ virtual1 $ cat /System/Library/CoreServices/SystemVersion.plist | uuencode - | sed "s/\$/`echo $'\r'`/" | xxd | head -n 10
0000000: 6265 6769 6e20 3634 3420 2d0d 0a4d 2f23 begin 644 -..M/#
0000010: 5d58 3b36 5040 3d46 3552 3c56 454f 3b43 ]X;6P@=F5R<VEO;C
0000020: 5442 2c32 5850 2842 2145 3b46 2d4f 3926 TB,2XP(B!E;F-O9&
0000030: 454e 3953 5442 3535 3126 2b33 4042 2f53 EN9STB551&+3@B/S
0000040: 582a 2f22 2524 3354 2d34 0d0a 4d36 3521 X*/"%$3T-4..M65!
0000050: 2528 2721 4c3a 372d 5428 2521 3530 4451 %('!L:7-T(%!50DQ
0000060: 2930 5260 422b 325c 4f30 3721 503b 2634 )0R`B+2\O07!P;&4
0000070: 4f2b 5431 3431 2221 3033 2445 3335 2260 O+T141"!03$E35"`
0000080: 512b 4360 4f2b 5435 2e0d 0a4d 2842 6042 Q+C`O+T5...M(B`B
0000090: 3a27 3154 3c23 484f 2b57 3d57 3d52 5941 :'1T<#HO+W=W=RYA
looks like uuencode outputs unix linefeeds. (OA only) The above fixes that problem. I hate it when I google for an answer and find ten copies of the wrong answer. sed 's/$'"/`echo \\\r`/" does NOT work. Anyway, the above converts the output of uuencode to dos (CRLF) linefeeds. Email apps can be fickle though, if they see a single unix linefeed in the email it could stop them in their tracks so you may have to make sure the entire email is CRLF. Build the email the way you were before with >> and then cat THAT through the sed to a second file, and email that file, so the entire email is dos style linefeeds.
so much fun dealing with email apps that expect everything to be provided to them a a very peticular way