Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail::Send Not Working

Status
Not open for further replies.

benkmann

ISP
Jun 2, 2006
10
0
0
US
Hi all,

I'm using the Mail::Send module, and it works fine, except it can't close the message and errors out. Here's the error:

Can't call method "close" on an undefined value at Autologin2.pl line 88.
> Terminated with exit code 9.

Here's the relevant corresponding code:

$msg = new Mail::Send;

$msg->to('test@test.com');
$msg->subject('Due Books');
$msg->cc('test@test.com');


# Launch mailer and set headers. The filehandle returned
# by open() is an instance of the Mail::Mailer class.
# Arguments to the open() method are passed to the Mail::Mailer
# constructor.

$fh = $msg->open; # some default mailer


$flag = 1;
}


print "The book, $elements[0] (by $elements[1]), is due in the next 7 days on $due_month/$due_day.\n";
print $fh "The book, $elements[0] (by $elements[1]), is due in the next 7 days on $due_month/$due_day.\n";


}
else {
print "Book not due in the next 7 days.\n";

}

}
}
}

$fh->close; # LINE THAT IS ERRORING OUT!

Any ideas? Thanks!
 
my guess is this line:

$fh = $msg->open;

is not getting working, try this:

$fh = $msg->open or die "Can't open $msg: $!";

and see if it returns an error message.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top