You should use either Mime::Lite or MIME::Entity as they were designed to take the heartache out of doing this. Anyway your problem is you hand rolled formatting is wrong. Amongst other things you need:

boundary="some_string" --some_string what's this eh, we need two leading -- for the boundary --some_string blah, note extra two -- on end of closing boundary below --some_string--

You have random spaces, no quotes (optional but good), missing leading and trailing -- and no closing boundary so your boudaries are broken. Here is an example generated using MIME::Entity that shows you the correct format. It also shows you how easy it is to use. You can attach text, html, binary files (images etc):

use MIME::Entity; my $html = "<html>\n<head>\n</head>\n<body>\n <p>This is some text\n< +/body>\n</html>\n"; my $text = "This is some text\n"; ### Create the top-level, and set up the mail headers: $top = MIME::Entity->build(Type => "multipart/alternative", From => 'me@myhost.com', To => 'you@yourhost.com', Subject => "Hello World!"); $top->attach(Data => $text, Type => "text/plain", Encoding => "quoted-printable"); $top->attach(Data => $html, Type => "text/html", Encoding => "quoted-printable"); $top->print(\*STDOUT); __DATA__ Content-Type: multipart/alternative; boundary="----------=_1020843667-205993-0" Content-Transfer-Encoding: binary MIME-Version: 1.0 X-Mailer: MIME-tools 5.316 (Entity 5.212) From: me@myhost.com To: you@yourhost.com Subject: Hello World! This is a multi-part message in MIME format... ------------=_1020843667-205993-0 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: quoted-printable This is some text ------------=_1020843667-205993-0 Content-Type: text/html Content-Disposition: inline Content-Transfer-Encoding: quoted-printable <html> <head> </head> <body> <p>This is some text </body> </html> ------------=_1020843667-205993-0--

As an additional comment print MAIL "blah"; print MAIL "blech"...on and on could be replaced with a nice neat heredoc like this:

$message = <<"END_MESSAGE"; To: $email Reply-to: <$our_email> From: $us <$our_email> Subject: $list_name Hello $name, $message $us END_MESSAGE open ('MAIL', "|$mail_prog -t -i") or DieNice("Can't open '$mail_prog' +: $!\n"); print MAIL $message;

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Sending Rich/HTML email by tachyon
in thread Sending Rich/HTML email by nmerriweather

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.