By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Mail::Bulkmail - Can't call method "_not_worthless" on unblessed reference at

P: n/a

Ok... I know there is got to be something simple that I forgot, but I for the life of me can't find it. Please, for the sake of the wall I keep slamming my head into, any insight would be helpful.

Every time I try and run my script I get: Can't call method "_not_worthless" on unblessed reference at /usr/lib/perl5/site_perl/5.8.0/Mail/Bulkmail.pm line 1700, <CONF> line 9

It's a pretty straight forward script (or so I'm thinking)

#!/usr/bin/perl

# Perl Script to handle mailing.
# This replaces the WAY TOO vulnerable majordomo system we were using.

use strict;
use DBI();
use Mail::Bulkmail;
use Mail::Bulkmail::Server;

# Die if we don't have the right number of parameters.
die ("Usage: ./mailbot.pl uid mailoutid\n") if ($#ARGV != 1);
my $uid = $ARGV[0];
my $moid = $ARGV[1];

# Setup the database.
my $dbh = DBI->connect("DBI:mysql:database=x:host=localhost","x" ,"x");
my $sth = $dbh->prepare("SELECT * FROM newemails WHERE uid=$uid AND active=1");
$sth->execute();
# Migrate all that returns to an array for processing.
my @maillist = [];

while (my $ref = $sth->fetchrow_hashref()) {
push(@maillist,$ref->{'address'});
}

for ($a = 0; $a < @maillist; $a++) {
print("$maillist[$a]\n");
}
# Setting up the mail
my $server = Mail::Bulkmail::Server->new(
'Smtp' => '127.0.0.1',
'Port' => 25
) || die Mail::Bulkmail::Server->error();

my $bulk = Mail::Bulkmail->new() || die Mail::Bulkmail->error();
$bulk->From("myaddress\@somewhere.com");
$bulk->Sender("myaddress\@somewhere.com");
$bulk->ReplyTo("myaddress\@somewhere.com");
$bulk->Subject("Test");
$bulk->Message("Ooooo!");
$bulk->use_envelope(0);
$bulk->Trusting(1);
$bulk->servers([\$server]);
$bulk->LIST(@maillist);

$bulk->bulkmail() || die $bulk->error;

$sth->finish();
$dbh->disconnect();
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> $bulk->servers([\$server]);

That's a bug in the documentation, it'll be fixed in the next release.
Don't hand in refs to the server objects.

$bulk->servers([$server]);

Incidentally, the preferred method is to specify the server information
in the conf file by having it point to a server_file. Much easier to
configure that way.

And, finally, I respond quicker to emails than newsgroup postings, as a
general rule, in case there are any future issues. :)

-Jim.....
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.