Thanks for your replies. To demerphq, I must apologise, the code I gave that you refer to does work. The problem was that I was getting "$address" from a multiple combo box on a web page.

This was putting a blank character as the first letter of each recipient, except for the first. I don't know what the character was as it didn't show up at all when I printed $address out on the HTML page generated by the script. It wasn't whitespace either as it survived this:

s/^\s+//; s/\s+$//;
However, when I turn $address into an array and do the following to every item but the first:
substr($string, 0, 1) = "";
It works perfectly. Obviously the HTML puts a weird character between items from the combo box. I was misled by the fact that it doesn't show up when you output the string to HTML. Not as a space, a carrage return or anything.

For the record, I tried substituting the 'smtp' command in the Mail::Mailer code with 'test', to produce the email as output, and ran it on the command line. It produced the following:

to: one@example.com
From: sender@example.com
To: one@example.com
Subject: Subject

I don't know if this was what it should have returned, but it doesn't look at all right to me. Maybe this was why the mail server was knocking it back.

I got MIME::Lite to do exactly what I wanted it to (eventually!). It works, it's good, I'm happy.

Cheers,

Andy.


In reply to Re: Mail::Mailer & MIME:Lite On Win2k by Murf
in thread Mail::Mailer & MIME:Lite On Win2k by Murf

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.