What is the MIME equivalent of uuencode for sendmail?

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 [email protected]

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

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

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.

Solution 2

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 muttmsmtp 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.

Solution 3

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.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply