Reputation: 646
I'm working with Perl on Windows. I will try to send mail with Email::Sender module. But I couldn't install module for Email::Sender.
Upvotes: 4
Views: 5821
Reputation: 107040
Although Email::Sender
has nice and simple command structure, it's not part of the standard Perl installation. However, Net::SMTP is.
Yes, Net::SMTP
is a bit more complex to use, but you probably already have it installed, and if your Perl scripts are used on various machines -- including machines where installing CPAN modules might not be possible -- it's one less complication that you have to deal with.
If you really prefer Email::Sender
, you can install it depending on what type of Perl installation do you have. If you have ActiveState, you can use the Perl Package Manager (it's in the Start Menu under ActiveState) to download Email::Sender
for you.
Looking at your error messages, try first installing Archive::Tar
and Compress::Zlib
and see if that helps installing Email::Sender
.
If not, and you have 7Zip installed, go to the /home/user name/.cpan/sources/authors/id/R/RJ/RJBS
directory, and manually uncompress the file Em
ail-Sender-0.110005.tar
using 7Zip. If that fails, go to the CPAN page for Email::Sender manually download the gripped tar ball, and uncompress it using 7Zip.
Once that's done, you'll have to manually run the following commands:
C> perl Makefile.PL
C> nmake
1
C> nmake test
C> nmake install
After all, that's what CPAN does.
One more thing: Take a look at my svn-watch.pl program. Around line #767 is an actual example of using Net::SMTP
. I also use Mail::Sendmail
which is another Perl email module because some sites have trouble with Net::SMTP
, so I give them the option to use Mail::Sendmail
instead. You can see the logic I use to determine whether Mail::Sendmail
is installed, and if it is, to use that. If Mail::Sendmail
isn't installed, I default to Net::SMTP
. That test logic is on line #739 to #742.
Hope this helps.
1.The command may be either nmake
or make
depending on your Perl distro.
Upvotes: 1
Reputation: 929
I used cpan Email::Sender
command, and then output is like followings :
CPAN: Storable loaded ok
Going to read /home/user name/.cpan/Metadata
Database was generated on Wed, 04 Apr 2012 09:59:04 GMT
Running install for module Email::Sender
Running make for R/RJ/RJBS/Email-Sender-0.110005.tar.gz
CPAN: Digest::MD5 loaded ok
CPAN: Compress::Zlib loaded ok
Checksum for /home/user name/.cpan/sources/authors/id/R/RJ/RJBS/Email-Sender
-0.110005.tar.gz ok
Scanning cache /home/user name/.cpan/build for sizes
sh: /home/user: No such file or directory
/bin/tar: This does not look like a tar archive
/bin/tar: Exiting with failure status due to previous errors
Uncompressed /home/user name/.cpan/sources/authors/id/R/RJ/RJBS/Email-Sender
-0.110005.tar.gz successfully
Using Tar:/bin/tar xvf /home/user name/.cpan/sources/authors/id/R/RJ/RJBS/Em
ail-Sender-0.110005.tar:
/bin/tar: /home/user: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now
Couldn't untar /home/user name/.cpan/sources/authors/id/R/RJ/RJBS/Email-Send
er-0.110005.tar
Upvotes: 3
Reputation: 943560
Assuming you mean the CPAN module Email::Sender
(Perl is case sensitive), and not some other module that isn't in CPAN, then you use the package installer that came with your Perl distribution.
In most cases that will be:
cpan Email::Sender
There are more details and methods linked from the Getting Started section of the CPAN homepage.
Upvotes: 3