Hi Friends

I have written a perl script which sends an email on Windows using NetSMTP.

#print "Hello world";
use Net::SMTP;
use strict;
my $smtpserver = '';
#my $smtpserver = '';
my $smtpuser = 'myname';
my $fromemail = 'myname@mycompany.com';

    my $smtp = Net::SMTP-> new($smtpserver, Timeout => 10);
    $smtp-> mail($smtpuser);
    $smtp-> to('friend@mycompany.com');
    $smtp-> data();
    $smtp-> datasend("To: blblb\@blblbl.cz\n");
    $smtp-> datasend("From: psmejkal\@tesco.cz\n");
    $smtp-> datasend("\n");
    $smtp-> datasend("test\n");
    $smtp-> dataend();
    $smtp-> quit;

While executing the program Im getting the following error

Can't call method "mail" on an undefined value at ./mail.pl line 11.

Any clue?

Could it have anything to do with the fact that $smtpuser is not a valid email address? It's only the string 'myname'. The variable $fromemail is your email address.