Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can AIX/UNIX send mail with html message AND an attachment?

687 views
Skip to first unread message

noon...@mail.com

unread,
Mar 30, 2006, 10:37:19 AM3/30/06
to
Is there an easy way to send a formatted html message AND an html
attachment from AIX/UNIX? We need to send our users reports that are
quite wide, and when it goes to Notes the columns are wrapped and it
doesn't look pretty.

What the users want is an email with an abbreviated report of a few
fields, and then an html attachment that displays the entire report.
They want the email in html so it has the bold/highlighted text, table
format, etc.

The mail command doesn't send html message, but you can send an html
attachment with uuencode.

The sendmail command will send the html message, but will not allow
attachments (at least I can't figure out how).

Any ideas?

Mark

Luiz Henrique de Figueiredo

unread,
Mar 30, 2006, 2:08:15 PM3/30/06
to
In article <1143733039.4...@t31g2000cwb.googlegroups.com>,

<noon...@mail.com> wrote:
>Is there an easy way to send a formatted html message AND an html
>attachment from AIX/UNIX?

>The sendmail command will send the html message, but will not allow


>attachments (at least I can't figure out how).

Try matt at ftp://ftp.tecgraf.puc-rio.br/pub/lhf/matt.tar.gz but you'll
need mmencode.

AK

unread,
Mar 30, 2006, 5:52:03 PM3/30/06
to
noon...@mail.com wrote:

You can simplify this, by sending a user a notice that their report is
done and that it can be viewed at http://yoursite/login

AK

Sam

unread,
Mar 30, 2006, 6:57:42 PM3/30/06
to
noon...@mail.com writes:

> Is there an easy way to send a formatted html message AND an html

> attachment from AIX/UNIX? …

Yes. You can also to do the same thing from Linux, BSD, Windows, and even
Commodore 64 (if you somehow hook one up to the Internet).

The Internet standard for formatting content is called MIME, and it is
irrelevant who sends a MIME message, as long as it is formatted correctly.
It is a simple matter of constructing a message with a multipart/mixed
content type, and two sections: a text/html section marked for inline
disposition, and a second text/html section marked for attachment
disposition.

> The sendmail command will send the html message, but will not allow
> attachments (at least I can't figure out how).

sendmail doesn't give a damn what you're sending (with very few exceptions
that are not relevant here).

You need to create a message that's formatted, more or less, as shown below.
You will also need to read, AND UNDERSTAND, at least the following
specification:

http://www.ietf.org/rfc/rfc2045.txt

http://www.ietf.org/rfc/rfc2046.txt

There are tools that can easily assemble a message, like the following for
you. But you need to understand MIME, before you try to use them.

Anyway, you need to assemble a message that looks approximately like this:


From: whoever
To: whoever
Subject: whatever
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="MIME_BOUNDARY_FLOORDYBOOP"

Beavis, and Bigfoot, sitting-in-a-tree...

--MIME_BOUNDARY_FLOORDYBOOP
Content-Type: text/html
Content-Disposition: inline

<html>

[ your HTML message ]

</html>

--MIME_BOUNDARY_FLOORDYBOOP
Content-Type: text/html
Content-Disposition: attachment; filename="attachment.html"

<html>

[ Your attachment ]
</html>

--MIME_BOUNDARY_FLOORDYBOOP--

To understand what all of the above means, and how it works, you will need
to read the documentation at the above URLs.

Also, note, that although the above may be a well-formed MIME message, it is
always possible for buggy mail software to screw it up, and not handle it
correctly. All I can tell you is that the above MIME formatting is correct,
and describes an E-mail message that consists of two parts: main HTML
content, that should be shown, and an attached file, which also contains
HTML content. If Notes can't handle it, go bitch at IBM to fix their
software.


Malcolm Dew-Jones

unread,
Mar 30, 2006, 8:02:17 PM3/30/06
to
noon...@mail.com wrote:
: Is there an easy way to send a formatted html message AND an html


http://nisoftware.com/files/mailattach

is an example of how to use Perl and MIME::Lite to generate (and send) a
multi part message.

You could use the above utility by creating a text version of your
contents and an html version of your contents and then typing something
like

echo "This message has a text and an html attachment" | \
mailattach som...@some.where.com -- myfile.txt myfile.html

(The echo is because the utility requires input from standard input.)

If you don't like the syntax or whatever then use it just as an example.

0 new messages