Nothing immediately jumps out at me as being wrong, but there are a few things that could use some error checking. First, you really ought to be using -w and strict. That'll catch typos and dangerous constructs and will save you plenty of debugging time.

Even if you don't use them here, you absolutely must check to see if your open call succeeded:

### Opens the file to place content to be e-mailed open (F, ">$nice") || die "Can't open $nice: $!";
Since we can't tell right now if that worked, your program could be correct all over except for an open path or something... this is the first place I'd look. Same goes for the system call, as a matter of fact. (And on there, it's more secure to pass it a list of options rather than a string. You can avoid shell interpolation that way -- a good thing to do. However, as you appear to be on a Windows machine, the amount of damage someone can do with the default shell is lower than on Unix.)

As a side note, and having not worked with Access very much, I wonder why you don't move the 'country eq US' comparison into your SQL statement. A good relational database will be able to perform this faster than you can in Perl:

### Sql statement my $statement="SELECT web_id, mail_alias FROM lexnex_ids WHERE countr +y = 'US'";
As a nice side effect, you don't have to do two DB queries, which may solve some other things (I'm not sure that issuing a new query to the Perl ODBC object while fetching from an older query is anything but trouble).

I hope this helps.


In reply to (chromatic) Re: Mass Mail by chromatic
in thread Mass Mail by Kiko

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.