e.g., I've got files I want to send by sendmail but the receiving mailbox (for posting pictures to my blog) will not accept uuencode files a la

$uuencode file | sendmail user@domain

I'm guessing it'll accept MIME though. So what command can I use instead?

3 Answers 3


You need mimencode from the metamail package... Debian has some package info, but the package is based on ancient Bellcore code.

If you're just trying to send mail though, you might look into using mutt; I think it can mimencode attachments from the commandline.

  • Yes, mutt does properly mime-encode which I know as I was just noodling with it: askubuntu.com/questions/5431/…
    – msw
    Oct 14, 2010 at 3:47
  • Hmm. metamail's no longer a debian package, it looks like.
    – ixtmixilix
    Oct 15, 2010 at 21:37

The best luck I had was with mime-construct, written in Perl. It does pretty much everything uuencode does, and is pipeable, which is what I needed. (No, I was not looking for an MTA such as mutt... msmtp is all I need, thank you very much.)

For people interested, you call it using something like

$mime-construct --output --to "[email protected]" --file-attach "a.jpg"

which prints a load of random gobbledygook to stdout, just as uuencode would if you didn't pipe it somewhere else.


man qprint

DESCRIPTION The MIME (Multipurpose Internet Mail Extensions) specification RFC 1521 and successors) defines a mechanism for encoding text consisting primarily of printable ASCII characters, but which may contain characters (for example, accented letters in the ISO 8859 Latin-1 character set) which cannot be encoded as 7-bit ASCII or are non-printable characters which may confuse mail transfer agents.

   qprint is a command line utility which encodes and decodes files in this format.  It  can  be  used  within  a
   pipeline  as  an encoding or decoding filter, and is most commonly used in this manner as part of an automated
   mail processing system.  With appropriate options, qprint can encode pure binary files, but it's a poor choice
   since it may inflate the size of the file by as much as a factor of three.  The Base64 MIME encoding is a bet-
   ter choice for such data.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .