in reply to Sending Mail trough Perl using ActivePerl on windows
Please to see the below two programs to send mail through perl using activeperl on windows.
One is using the module Mail::Sendmail and the other is using the module MIME::Lite.
Program 1 using the module Mail::Sendmail.
#!C:/Perl/bin/perl.exe
use Mail::Sendmail;
my $to_list = 'john@gmail.com';
my $cc_list = 'frank@yahoo.com';
my $email = "\n\nThis email was generated automatically.\n";
my $MailFrom = "test\@gmail.com";
my $subject = "hello test";
my $message = "module test";
%mail = (
To => $to_list,
From => $MailFrom,
Bcc => $bcc_list,
Cc => $cc_list,
Subject => $subject,
Message => $message
);
$mail{Smtp} = 'mailtest.gmail.com';
sendmail(%mail)
Program 2 using the module MIME.
#!C:/Perl/bin/perl.exe
use MIME::Lite;
MIME::Lite->send('smtp', "mailtesthub.gmail.com", Timeout=>90);
my $email = "This email was generated automatically.";
my $subject = "hello test";
my $MailFrom = "john@gmail.com";
my $to_list = 'frank@yahoo.com';
my $cc_list = 'sam@rediffmail.com';
$msg = MIME::Lite->new(
From => $MailFrom,
To => $to_list,
Cc => $cc_list,
Bcc => $bcc_list,
Subject => $subject,
Type => 'TEXT',
Encoding=> '7bit',
Data => $a
);
$msg->send()
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Sending Mail trough Perl using ActivePerl on windows
by the_hawk_1 (Scribe) on Jun 20, 2007 at 16:27 UTC | |
by Anonymous Monk on Mar 14, 2009 at 02:56 UTC | |
by Anonymous Monk on Sep 25, 2009 at 08:12 UTC | |
by Anonymous Monk on Mar 14, 2009 at 03:26 UTC | |
Re^2: Sending Mail trough Perl using ActivePerl on windows
by Anonymous Monk on Oct 24, 2009 at 20:17 UTC | |
by marto (Cardinal) on Oct 25, 2009 at 08:31 UTC |
In Section
Seekers of Perl Wisdom