views:

89

answers:

1

I have this simple part of the program that should send an email to a specified user. But it has an error that says "Can't call method "MailMsg" on an undefined value"

 if ($sender->MailMsg({smtp => 'mail.myISP.com',
   from => 'suezy.ourdomainhere.com',
   to =>'[email protected]',
   subject => 'this is a test',
   msg => "testing....\n?"}) < 0) 
 {
  die "$Mail::Sender::Error\n";
 }
   print "Successfully sent."

Something wrong? Can anyone give me suggestions please? Is it possible that I wasn't able to install the package properly?

+4  A: 

Your problem is that $sender is not defined - i.e. the variable has no value in it.

Have you created a Sender object doing something like the following:

$sender = new Mail::Sender
  {smtp => 'mail.yourdomain.com', from => '[email protected]'};
Dave Webb