0

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 =>'sample@domainhere.com',
   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?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Suezy
  • 1,071
  • 4
  • 13
  • 19

1 Answers1

3

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 => 'your@address.com'};
David Webb
  • 190,537
  • 57
  • 313
  • 299