I'm trying to get a system on my home network to send an image (.png) via email. The closest I have gotten is this:
uuencode -m snapshot.png snapshot.png | mailx -r "[email protected]" -s "Snapshot" -S smtp=smtp.myremoteserver.net [email protected]
Which gets the mail to me, but the output leaves a bit to be desired...
begin-base64 755 snapshot.png
AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8A
AAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA
(well, you get the idea...)
AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8A
AAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/
====
The trouble is, I HAVE to send through smtp.myremoteserver.net. But the image file isn't getting decoded by my mail client (I've tried in Thunderbird and in various webmail interfaces, same result). Is there a better way that actually works?
Update: Just for the fun of it, I ran this:
uuencode -m snapshot.png snapshot.png > coded.txt
And upon decoding it, I got a scrambled, unviewable mess. So the problem must be with the uuencoding.
I had the same problem and fixed by switch to sendmail, which sends mime types.
I don't have mimencode in production so I used openssl which seems same:
If you have more recipients, or subject, you can input at the beginning of the pipe, and append mimencode output at the end, eg.,
You can output all these to a file and then cat to the sendmail pipe.