#!/usr/bin/perl -w
use Net::SMTP;
$smtp = Net::SMTP->new('mailhost');
print $smtp->domain,"\n";
$smtp->quit;
このplファイルを実行すると、「未定義の値でメソッド「ドメイン」を呼び出すことができません」というエラーが表示され、このplファイルで次のようになります。
#!/usr/bin/perl -w
use Net::SMTP;
$smtp = Net::SMTP->new('mailhost');
$smtp->mail($ENV{USER});
$smtp->to('postmaster');
$smtp->data();
$smtp->datasend("To: postmaster\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test message\n");
$smtp->dataend();
$smtp->quit;
エラーが発生しますCan't call method "mail" on an undefined value
私は何をする必要がありますか ?