I did a really basic mailer, but I highly recommend Mail::Bulkmail, as it provides many, many more features and error checking etc.

If your are interested:

Mailer:

use strict; use warnings; use Mail::Sendmail; my $from = '"Company Surveys" <surveys@surveys.com>'; my $subject = 'Your Survey'; open LIST, "<mailinglist" or die "Cannot open mailing list: $!"; open MESSAGE, "<mailinglist-message" or die "Cannot open mailinglist message: $!"; my @message = <MESSAGE>; my %mails = ( From => "$from", Subject => "$subject", Message => join "", @message, ); while (<LIST>) { sendmail('To' => $_, %mails) or warn $Mail::Sendmail::error; print "Message has been sent to $_"; }; close LIST; close MESSAGE; print "All e-mails sent successfully.\n\n";

Update: while was a foreach, due to a bad coding mistake. Thanks Animator

mailinglist-message is something like:

Dear Potential Customer, blah blah From time to time, we would like to send you more surveys and our newsletter. We respect your privacy, therefore, if you wish to unsubscribe from our list, please reply, changing the Subject Line to: unsubscribe

mailinglist is something like:

ghenry@me.com ghenry@me.org gavin.henry@me.com ghenry@me.co.uk ghenry@me.uk
etc. etc.

HTH.

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!

In reply to Re: Bulk Mail by ghenry
in thread Bulk Mail by Anonymous Monk

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.