I'm putting together a form to mail some data to one of users and am using Net::SMTP to mail them. However I keep coming across an error message whilst testing saying that I have an undefined value in $smtp->mail( $from );
but I'm sure I have defined this further up the form. I would be grateful if somebody could point out what I have missed as this is the first time I've used this module and I'd like to leanr how to make it work properly.
my $mailserver_url = "foo.bar.baz";
my $to = "foo\@bar";
my $from = "bar\@foo";
my $subject = "Mail time";
my $smtp = Net::SMTP->new('$mailserver_url');
#Sending the message
$smtp->mail( $from );
$smtp->to( $to );
$smtp->datasend("\n"); # done with header
$smtp->datasend($name, $company, $country, $email);
$smtp->quit(); # all done. message sent.