Anders Holm wrote:
>
> Hi folks!
Hello,
> I'm trying to do a test on one of our servers where I'd like to send one
> mail message to upto 1000 recipients.
> For this I'd like to use Mail::Bulkmail...
>
> Now, I seems to be messing it up somehow, and am very short on time.. :(
> Could someone help me out here??
>
> The usernames I'm sending to is user[1-1000]@mydomain.com...
>
> Here's the quick and dirty code I threw together..
>
> #!/usr/local/bin/perl
You should let perl help to find mistakes with warnings and strict
#!/usr/local/bin/perl -w
use strict;
> use Mail::Bulkmail;
>
> $bulk = Mail::Bulkmail->new(
my $bulk = Mail::Bulkmail->new(
> From => '[EMAIL PROTECTED]',
> Smtp => 'smtp.mydomain.com',
> Port => '25',
There is no point in stringifying a number.
Port => 25,
> Subject => 'Testing ISS mail service',
> Message => 'TEST'
> );
>
> while($rcpt <= 1000) {
> $bulk->List("user" . "$rcpt" . "@mydomain.com");
> }
What value is $rcpt at the start of the loop? Since you don't change
the value of $rcpt in the loop it will always use the same value. This
would usually be writen as:
for ( 1 .. 1000 ) {
$bulk->List( "user$_\@mydomain.com");
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]