Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

mailx mime types

Thomas Broccoletti
Occasional Advisor

mailx mime types


Sending outbound email using mailx with attachments work on some email clients but not others. It seems like mailx does not set the content-type correctly and thus causing the attachment to appear in the body of the email as garbage. I installed PHNE_34304 that fixed some problems with mailx, however, it doesn't help the outbound mail attachments.
Steven Schweda
Honored Contributor

Re: mailx mime types

Does anyone other than you and the psychics
know exactly what you're doing with mailx, or
exactly what is getting sent out as e-mail
when you do it?

The last time I used "mailx" (long ago), if
it knew what MIME was, I was blissfully
unaware of it. While I don't do this stuff,
so I know nothing, if I were to try, I would
start by using a program like "mpack" to
create a MIME-compliant message file (which
I could examine at my leisure), and then
using a program like "mailx" (in its
stupidest mode -- "-m"?) to send the result.

Knowing nothing, I can't be confident, but
I'd imagine that feeding MIME into a program
which might add its own "Mime Version,
Content Type & Content Encoding to the header
information while sending mails" could cause
it to spew some mess which might confuse the
recipient. ("man mailx".)

A Forum search here for keywords like, say,
e-mail attachment
should find many old threads on this subject.
Many folks seem to recommend using
"uuencode", but, as I said, I'd try "mpack"
(or something similar) to form a
MIME-compliant message file.
Honored Contributor

Re: mailx mime types


Try adding these two lines into your /usr/share/lib/mailx.rc file.

set charset=us-ascii
set mimeheader=no

and then send the email attachment. I hope you are using "uuencode" or something similar.

Hope this helps.

Dennis Handly
Acclaimed Contributor

Re: mailx mime types

>It seems like mailx does not set the content-type correctly

mailx(1) knows nothing about attachments and basically sets the mime type to something simple like:
Content-Type: text/plain; charset=us-ascii
Rita C Workman
Honored Contributor

Re: mailx mime types

Hi Thomas,

mailx is actually an "interactive message processing system" per the manpages.

As such it doesn't have the power or flexibility to do all the MIME things.

You can use a software utility like mpack or you can use the HPUX MIME tools like sendmail or elm. Personally I use elm all the time and for attaching documents, although there are wonderfully a plethora of different utilities other prefer, my favorite is using a seperate file that uses the [include statements]. I like the include statement because I can send attachments be they plain text or MS Excel docs or images (jpeg,tiffs, etc) and I can also change things from being a base64 to quoted-printable,etc.
There have a number of MIME threads covering various ways to do this, so may I suggest you simply do a Search for MIME mail attachments and enjoy.

Kindest regards,
Dennis Handly
Acclaimed Contributor

Re: mailx mime types

>Rita: an "interactive message processing system" per the manpages.

That's a slight overstatement. It forgot to mention that it was from circa 25 years ago. :-)
I'll admit I still use it and use thunderbird if I have to deal with attachments.