SourceForge has been redesigned. Learn more.

#2 multipart/alternative


Congratulation for a very useful application!

In your project I found almost all features that I need.
Send html, embedded images ...

I want to send email with plain and html version with
embed images. To send this kind of email I need a
special content-

I tried to send a email using several option but without
any result. I could setting this content-type using -a1,
but automatically content-type=text/html will be added.

Could you please add the follow feature in your next

- an option to set no content-type
- an option to include more than 2 custom header
- an option to set a custom content-type, instead of -
html, (preferred)
- an option to set content-
ry="". (In this case the boundary must be settable,
because it must be defined in the body)

Unfortunately I'm possessing the necessary knowlegde
in C+ the contribute to your project directly.

Feel free to contact me at

Boris Chiavi

example (also as attachement):

From: Boris Chiavi <>
To: <>
Date: Mon, 08 August 2003 09:41:09 -0800 (PST)
Subject: Formatted mail
MIME-Version: 1.0
Content-Type: multipart/related;
type=multipart/alternative; boundary=boundary42

Content-Type: multipart/alternative;boundary=----

Content-Type: text/plain; charset=iso-8859-1

... plain text version of message goes here ...

Content-Type: text/enriched

... RFC 1896 text/enriched version of same message
goes here ...

Content-Type: text/html; charset=iso-8859-1

... html version (with or without embedded images) of
same message goes here ...

Content-Type: image/gif; name="blind.gif"
Content-Transfer-Encoding: base64
Content-ID: <blind.gif>




  • Boris Chiavi

    Boris Chiavi - 2003-08-09

    multipart/alternative example

  • Chip

    Chip - 2003-08-09

    Logged In: YES

    First, to get more than two custom headers, use the -penguin
    option and have your headers in the first lines of the message.

    Next, if we created a new option -althtml to put that text
    into the message, would this work for you to set the
    multipart/alternative? The text/enriched message would not
    be automatically included by Blat. Blat would add a plain
    text warning message like "We attempted to deliver this
    message to you with HTML formatting. However, your e-mail
    program does not support HTML-enhanced messages."

    In order to have text/enriched from html, Blat would have to
    learn html/xml to make the conversions. Otherwise, Blat
    could strip the html/xml tags and leave just the text. It
    could also convert <BR> to carriage return/line feeds.

    As another choice, the -althtml could be used with a
    filename that would be the text you want. Or it could be
    two filenames, the first file would be the plain text
    message, the second file would be the enriched text message.


  • Boris Chiavi

    Boris Chiavi - 2003-08-10

    multipart/related;type=multipart/alternative message

  • Boris Chiavi

    Boris Chiavi - 2003-08-10

    Logged In: YES

    Blat v2.1.0 does not understand this argument. No entry in

    Actually I do not need the text/enriched part, this was only
    an example from RFC 2046 document. My gol is not to put a
    text like " if you read this your email-program does not
    support html ..." but to include the hole mail text in plain
    format. So that people supports html-enhanced, see the html
    mail, and the others the plain text. Please refer to RFC 2046
    5.1.4. This could be done with Content-
    Type=multipart/alternative. In my case, the html message
    includes embedded images and this require the Content-Type
    requested. The body will include plain text,html text and the
    images. Please look at my attachement. (I'm sending always
    email in particular format, but the client which generates the
    email and the smtp server are very slow)

    I tried to send using argument -a1 which adds the Content-
    Type, but blat adds automatically the Content-
    Type=text/html (=-html)
    (command: blat mail.txt -to -f -subject "HTML/PLAIN Text" -a1 "Content-
    Type: multipart/related;type=multipart/alternative;boundary=-")

    So the best think will be to have an argument which does not
    add a default Content-Type if -html/-embed/-enriched is
    omitted or to have an argument like -ct "Content-Type=..."
    so to defined a custom Content-Type


  • Chip

    Chip - 2003-08-13

    Logged In: YES

    The option is not -penguine, it is -penguin.

    If I create "-althtml <filename>" option for you, then you
    do not need to have custom Content-type headers. The
    -althtml option would let you give a filename that has plain
    text for your normal html file/message body.

    blat <htmlfile> -to <...> -subject <...> -althtml <textfile>

    Blat would take the <textfile> as the first part in the
    multipart/alternative, then use <htmlfile> as the second part.


  • Boris Chiavi

    Boris Chiavi - 2003-08-13

    Logged In: YES

    I understood your idea, but who is setting the Content-Type
    in the Header? How will be the boundary?
    I think to give more flexibility to users (they know how the
    Header should be) the option

    -noct = No default Content-Type

    is a good solution, because using -penguin the header in my
    tests is ok except that I have 2 Content-Type defined.

    blat mail.txt -to -f -
    subject "Test" -penguin

    Content-Type: multipart/related;

    Header of send email:
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Type: multipart/related;

    If you need some support for testing, do not hesitate to
    contact me directly


  • Chip

    Chip - 2003-08-31

    Logged In: YES

    Users generally do not know anything about the headers, or
    care. To them, they want to know if the message looks right
    in their mail reader.

    If you provide a file that is plain text, and a file that is
    html, let Blat do the work for you. I added code to support
    this, and have tested it, Blat is adding the correct headers
    to make this work properly. I experimented using plain text
    from a Microsoft MSN Groups message, and the html from that
    same message. After making sure the message source looked
    right, I sent the message to a few other people for their
    opinion on its appearance.


Log in to post a comment.