我正在尝试编写一个脚本,该脚本将使用Perl从服务器发送Gmail。代码如下所示。
use warnings;
use strict;
use Email::Sender;
use Email::Send::Gmail;
use Email::Simple::Creator;
my $email = Email::Simple->create (
header => [
From => 'xxxx@gmail.com',
To => 'yyyyy@gmail.com',
Subject => 'Oh no! The bathwater is overflowing!',
],
body => 'The bath water is overflowing.',
);
my $sender = Email::Send->new ({
mailer => 'Gmail',
mailer_args => [
username => 'xxxxx',
password => 'yyyyy',
]
});
$sender->send ($email);
For which I get the error `Can't locate object method "create" via package "Email::Simple" at file.pl line 9.`
导致此错误的原因是我安装了Email :: Simple Module和Gmail Modules。