Please see the below two programs to send mail through perl using activeperl on windows.
The first uses Mail::Sendmail and the second uses MIME::Lite.
use Mail::Sendmail;
my $MailFrom = 'test@gmail.com';
my $to_list = 'john@gmail.com';
my $cc_list = 'frank@yahoo.com';
my $subject = "hello test";
my $message = "This email was generated automatically.\n";
sendmail(
Smtp => 'mailtest.gmail.com',
From => $MailFrom,
To => $to_list,
Cc => $cc_list,
Subject => $subject,
Message => $message,
);
use MIME::Lite;
MIME::Lite->send('smtp', "mailtesthub.gmail.com", Timeout=>90);
my $MailFrom = 'test@gmail.com';
my $to_list = 'john@gmail.com';
my $cc_list = 'frank@yahoo.com';
my $subject = "hello test";
my $message = "This email was generated automatically.";
my $msg = MIME::Lite->new(
From => $MailFrom,
To => $to_list,
Cc => $cc_list,
Subject => $subject,
Type => 'TEXT',
Encoding => '7bit',
Data => $message,
);
$msg->send()