469,592 Members | 2,041 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

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


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
1 6984
> $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.

Similar topics

3 posts views Thread by Thierry | last post: by
1 post views Thread by vikas.khengare | last post: by
3 posts views Thread by sisqorap | last post: by
2 posts views Thread by r_ahimsa_m | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.