Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Sending Mail trough Perl using ActivePerl on windows

by Anonymous Monk
on Oct 06, 2015 at 10:29 UTC ( [id://1143908]=note: print w/replies, xml ) Need Help??


in reply to Sending Mail trough Perl using ActivePerl on windows

#!/usr/bin/perl use MIME::Lite; $to = 'abcd@gmail.com'; $cc = 'efgh@mail.com'; $from = 'webmaster@yourdomain.com'; $subject = 'Test Email'; $message = 'This is test email sent by Perl Script'; $msg = MIME::Lite->new( From => $from, To => $to, Cc => $cc, Subject => $subject, Type => 'multipart/mixed' ); # Add your text message. $msg->attach(Type => 'text', Data => $message ); # Specify your file as attachement. $msg->attach(Type => 'image/gif', Path => '/tmp/logo.gif', Filename => 'logo.gif', Disposition => 'attachment' ); $msg->send; print "Email Sent Successfully\n";

Replies are listed 'Best First'.
Re^2: Sending Mail trough Perl using ActivePerl on windows
by lbrandewie (Acolyte) on Feb 11, 2020 at 06:04 UTC

    Hey All,

    This code dates from 2015. MIME::Lite is not shipped with ActiveState's perl any more, and trying to install it (I used "cpan MIME::Lite") fails with a host of errors. I had similar problems with Mail::Sendmail.

    Does anyone have a solution that works in 2020? I'm using ActiveState 5.28.1.

    Thanks in advance,

    Lars

      You should post the details of your failed install attempt, better still move to Strawberry perl.

        Paring it down to just the error messages gives the following:

        C:\Users\Lars>cpan MIME::Lite >cpan.txt Warning: prerequisite Email::Date::Format 1.000 not found. Warning: prerequisite MIME::Types 1.28 not found. Warning: prerequisite Mail::Address 1.62 not found. 'dmake' is not recognized as an internal or external command, operable program or batch file. 'dmake' is not recognized as an internal or external command, operable program or batch file. Warning: prerequisite Date::Format 0 not found. Warning: prerequisite Date::Parse 0 not found. 'dmake' is not recognized as an internal or external command, operable program or batch file. 'dmake' is not recognized as an internal or external command, operable program or batch file. 'dmake' is not recognized as an internal or external command, operable program or batch file.

        I can't capture the entire output in one piece but cpan.txt contains the following:

        Loading internal logger. Log::Log4perl recommended for better logging Reading 'C:\Perl64\cpan\Metadata' Database was generated on Tue, 11 Feb 2020 06:41:02 GMT Running install for module 'MIME::Lite' CPAN: Digest::SHA loaded ok (v6.01) CPAN: Compress::Zlib loaded ok (v2.074) Checksum for C:\Perl64\cpan\sources\authors\id\R\RJ\RJBS\MIME-Lite-3.0 +31.tar.gz ok CPAN: Archive::Tar loaded ok (v2.30) MIME-Lite-3.031/ MIME-Lite-3.031/testin/ MIME-Lite-3.031/LICENSE MIME-Lite-3.031/INSTALLING MIME-Lite-3.031/MANIFEST MIME-Lite-3.031/t/ MIME-Lite-3.031/contrib/ MIME-Lite-3.031/README MIME-Lite-3.031/COPYING MIME-Lite-3.031/examples/ MIME-Lite-3.031/META.yml MIME-Lite-3.031/lib/ MIME-Lite-3.031/Makefile.PL MIME-Lite-3.031/changes.pod MIME-Lite-3.031/META.json MIME-Lite-3.031/lib/MIME/ MIME-Lite-3.031/lib/MIME/Lite.pm MIME-Lite-3.031/examples/mime_fwd MIME-Lite-3.031/examples/mime_longlines MIME-Lite-3.031/examples/mime_gif MIME-Lite-3.031/examples/nodisp MIME-Lite-3.031/examples/mime_hack MIME-Lite-3.031/examples/mime_postcard MIME-Lite-3.031/contrib/MailTool.pm MIME-Lite-3.031/contrib/README MIME-Lite-3.031/t/pod.t MIME-Lite-3.031/t/head.t MIME-Lite-3.031/t/addrs.t MIME-Lite-3.031/t/mime-version.t MIME-Lite-3.031/t/types.t MIME-Lite-3.031/t/data.t MIME-Lite-3.031/t/Utils.pm MIME-Lite-3.031/t/parts.t MIME-Lite-3.031/t/ExtUtils/ MIME-Lite-3.031/t/pod-coverage.t MIME-Lite-3.031/t/sendmail.t MIME-Lite-3.031/t/verify.t MIME-Lite-3.031/t/ExtUtils/TBone.pm MIME-Lite-3.031/testin/README MIME-Lite-3.031/testin/test.html MIME-Lite-3.031/testin/hello CPAN: YAML::XS loaded ok (v0.69) CPAN: CPAN::Meta::Requirements loaded ok (v2.140) CPAN: Parse::CPAN::Meta loaded ok (v2.150010) CPAN: CPAN::Meta loaded ok (v2.150010) CPAN: Module::CoreList loaded ok (v5.20181129_28) Configuring R/RJ/RJBS/MIME-Lite-3.031.tar.gz with Makefile.PL MIME::Lite is designed to take advantage of a variety of external modu +les if they are not present then MIME::Lite will attempt to do its best but its strongly recommend that you install them. These modules are: MIME::Types Mail::Address I can add these modules to the prereq list which will cause the files +to be automatically installed if they aren't already present Add prereqs? [Yes] Yes Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for MIME::Lite Writing MYMETA.yml and MYMETA.json RJBS/MIME-Lite-3.031.tar.gz C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK Running make for R/RJ/RJBS/MIME-Lite-3.031.tar.gz ---- Unsatisfied dependencies detected during ---- ---- RJBS/MIME-Lite-3.031.tar.gz ---- Email::Date::Format [requires] MIME::Types [requires] Mail::Address [requires] Running install for module 'Email::Date::Format' Checksum for C:\Perl64\cpan\sources\authors\id\R\RJ\RJBS\Email-Date-Fo +rmat-1.005.tar.gz ok Email-Date-Format-1.005 Email-Date-Format-1.005/README Email-Date-Format-1.005/Changes Email-Date-Format-1.005/LICENSE Email-Date-Format-1.005/dist.ini Email-Date-Format-1.005/META.yml Email-Date-Format-1.005/MANIFEST Email-Date-Format-1.005/t Email-Date-Format-1.005/t/basic.t Email-Date-Format-1.005/META.json Email-Date-Format-1.005/Makefile.PL Email-Date-Format-1.005/xt/release Email-Date-Format-1.005/xt/release/pod-syntax.t Email-Date-Format-1.005/lib/Email/Date Email-Date-Format-1.005/lib/Email/Date/Format.pm Email-Date-Format-1.005/t/000-report-versions-tiny.t Email-Date-Format-1.005/xt/release/changes_has_content.t Configuring R/RJ/RJBS/Email-Date-Format-1.005.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for Email::Date::Format Writing MYMETA.yml and MYMETA.json RJBS/Email-Date-Format-1.005.tar.gz C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK Running make for R/RJ/RJBS/Email-Date-Format-1.005.tar.gz RJBS/Email-Date-Format-1.005.tar.gz dmake -- NOT OK Running install for module 'MIME::Types' Checksum for C:\Perl64\cpan\sources\authors\id\M\MA\MARKOV\MIME-Types- +2.17.tar.gz ok MIME-Types-2.17/ MIME-Types-2.17/t/ MIME-Types-2.17/t/11typeol.t MIME-Types-2.17/t/40mojo.t MIME-Types-2.17/t/20types.t MIME-Types-2.17/t/30export.t MIME-Types-2.17/t/22accbest.t MIME-Types-2.17/t/10type.t MIME-Types-2.17/t/21accept.t MIME-Types-2.17/lib/ MIME-Types-2.17/lib/MIME/ MIME-Types-2.17/lib/MIME/Type.pm MIME-Types-2.17/lib/MIME/Types.pod MIME-Types-2.17/lib/MIME/types.db MIME-Types-2.17/lib/MIME/Type.pod MIME-Types-2.17/lib/MIME/Types.pm MIME-Types-2.17/lib/MojoX/ MIME-Types-2.17/lib/MojoX/MIME/ MIME-Types-2.17/lib/MojoX/MIME/Types.pod MIME-Types-2.17/lib/MojoX/MIME/Types.pm MIME-Types-2.17/bin/ MIME-Types-2.17/bin/collect-types MIME-Types-2.17/bin/update-iana MIME-Types-2.17/MANIFEST MIME-Types-2.17/xt/ MIME-Types-2.17/xt/99pod.t MIME-Types-2.17/xt/98perl.t MIME-Types-2.17/README.md MIME-Types-2.17/ChangeLog MIME-Types-2.17/README MIME-Types-2.17/Makefile.PL MIME-Types-2.17/META.yml MIME-Types-2.17/META.json Configuring M/MA/MARKOV/MIME-Types-2.17.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for MIME::Types Writing MYMETA.yml and MYMETA.json MARKOV/MIME-Types-2.17.tar.gz C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK Running make for M/MA/MARKOV/MIME-Types-2.17.tar.gz MARKOV/MIME-Types-2.17.tar.gz dmake -- NOT OK Running install for module 'Mail::Address' Checksum for C:\Perl64\cpan\sources\authors\id\M\MA\MARKOV\MailTools-2 +.21.tar.gz ok MailTools-2.21/ MailTools-2.21/lib/ MailTools-2.21/lib/Mail/ MailTools-2.21/lib/Mail/Field/ MailTools-2.21/lib/Mail/Field/AddrList.pod MailTools-2.21/lib/Mail/Field/AddrList.pm MailTools-2.21/lib/Mail/Field/Generic.pod MailTools-2.21/lib/Mail/Field/Date.pod MailTools-2.21/lib/Mail/Field/Date.pm MailTools-2.21/lib/Mail/Field/Generic.pm MailTools-2.21/lib/Mail/Mailer/ MailTools-2.21/lib/Mail/Mailer/smtp.pm MailTools-2.21/lib/Mail/Mailer/rfc822.pm MailTools-2.21/lib/Mail/Mailer/testfile.pm MailTools-2.21/lib/Mail/Mailer/sendmail.pm MailTools-2.21/lib/Mail/Mailer/smtps.pm MailTools-2.21/lib/Mail/Mailer/qmail.pm MailTools-2.21/lib/Mail/Cap.pod MailTools-2.21/lib/Mail/Mailer.pm MailTools-2.21/lib/Mail/Header.pod MailTools-2.21/lib/Mail/Send.pm MailTools-2.21/lib/Mail/Util.pm MailTools-2.21/lib/Mail/Cap.pm MailTools-2.21/lib/Mail/Header.pm MailTools-2.21/lib/Mail/Address.pod MailTools-2.21/lib/Mail/Address.pm MailTools-2.21/lib/Mail/Filter.pm MailTools-2.21/lib/Mail/Filter.pod MailTools-2.21/lib/Mail/Internet.pm MailTools-2.21/lib/Mail/Mailer.pod MailTools-2.21/lib/Mail/Field.pod MailTools-2.21/lib/Mail/Field.pm MailTools-2.21/lib/Mail/Internet.pod MailTools-2.21/lib/Mail/Util.pod MailTools-2.21/lib/Mail/Send.pod MailTools-2.21/lib/MailTools.pm MailTools-2.21/lib/MailTools.pod MailTools-2.21/MANIFEST MailTools-2.21/examples/ MailTools-2.21/examples/mail-mailer.pl MailTools-2.21/examples/rplyto_demo.PL MailTools-2.21/examples/forwd_demo.PL MailTools-2.21/examples/send_demo.PL MailTools-2.21/t/ MailTools-2.21/t/mailcap.t MailTools-2.21/t/internet.t MailTools-2.21/t/mailer.t MailTools-2.21/t/header.t MailTools-2.21/t/send.t MailTools-2.21/t/extract.t MailTools-2.21/t/require.t MailTools-2.21/ChangeLog MailTools-2.21/README.demos MailTools-2.21/xt/ MailTools-2.21/xt/99pod.t MailTools-2.21/MailTools.ppd MailTools-2.21/README.md MailTools-2.21/Makefile.PL MailTools-2.21/README MailTools-2.21/META.yml MailTools-2.21/META.json Configuring M/MA/MARKOV/MailTools-2.21.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for MailTools Writing MYMETA.yml and MYMETA.json MARKOV/MailTools-2.21.tar.gz C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK Running make for M/MA/MARKOV/MailTools-2.21.tar.gz ---- Unsatisfied dependencies detected during ---- ---- MARKOV/MailTools-2.21.tar.gz ---- Date::Format [requires] Date::Parse [requires] Running install for module 'Date::Format' Checksum for C:\Perl64\cpan\sources\authors\id\A\AT\ATOOMIC\TimeDate-2 +.31.tar.gz ok TimeDate-2.31/ TimeDate-2.31/ChangeLog TimeDate-2.31/MANIFEST TimeDate-2.31/t/ TimeDate-2.31/README TimeDate-2.31/META.yml TimeDate-2.31/lib/ TimeDate-2.31/Makefile.PL TimeDate-2.31/META.json TimeDate-2.31/lib/Date/ TimeDate-2.31/lib/Time/ TimeDate-2.31/lib/TimeDate.pm TimeDate-2.31/lib/Time/Zone.pm TimeDate-2.31/lib/Date/Language/ TimeDate-2.31/lib/Date/Format.pm TimeDate-2.31/lib/Date/Language.pm TimeDate-2.31/lib/Date/Parse.pm TimeDate-2.31/lib/Date/Language/Icelandic.pm TimeDate-2.31/lib/Date/Language/Occitan.pm TimeDate-2.31/lib/Date/Language/Spanish.pm TimeDate-2.31/lib/Date/Language/Hungarian.pm TimeDate-2.31/lib/Date/Language/Turkish.pm TimeDate-2.31/lib/Date/Language/Greek.pm TimeDate-2.31/lib/Date/Language/TigrinyaEritrean.pm TimeDate-2.31/lib/Date/Language/Russian_koi8r.pm TimeDate-2.31/lib/Date/Language/Swedish.pm TimeDate-2.31/lib/Date/Language/Czech.pm TimeDate-2.31/lib/Date/Language/TigrinyaEthiopian.pm TimeDate-2.31/lib/Date/Language/Chinese_GB.pm TimeDate-2.31/lib/Date/Language/Amharic.pm TimeDate-2.31/lib/Date/Language/Russian.pm TimeDate-2.31/lib/Date/Language/Finnish.pm TimeDate-2.31/lib/Date/Language/French.pm TimeDate-2.31/lib/Date/Language/Somali.pm TimeDate-2.31/lib/Date/Language/Afar.pm TimeDate-2.31/lib/Date/Language/Norwegian.pm TimeDate-2.31/lib/Date/Language/Romanian.pm TimeDate-2.31/lib/Date/Language/Dutch.pm TimeDate-2.31/lib/Date/Language/English.pm TimeDate-2.31/lib/Date/Language/German.pm TimeDate-2.31/lib/Date/Language/Brazilian.pm TimeDate-2.31/lib/Date/Language/Austrian.pm TimeDate-2.31/lib/Date/Language/Tigrinya.pm TimeDate-2.31/lib/Date/Language/Italian.pm TimeDate-2.31/lib/Date/Language/Oromo.pm TimeDate-2.31/lib/Date/Language/Sidama.pm TimeDate-2.31/lib/Date/Language/Danish.pm TimeDate-2.31/lib/Date/Language/Bulgarian.pm TimeDate-2.31/lib/Date/Language/Chinese.pm TimeDate-2.31/lib/Date/Language/Russian_cp1251.pm TimeDate-2.31/lib/Date/Language/Gedeo.pm TimeDate-2.31/t/cpanrt.t TimeDate-2.31/t/date.t TimeDate-2.31/t/lang.t TimeDate-2.31/t/format.t TimeDate-2.31/t/getdate.t Configuring A/AT/ATOOMIC/TimeDate-2.31.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for Date::Parse Writing MYMETA.yml and MYMETA.json ATOOMIC/TimeDate-2.31.tar.gz C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- OK Running make for A/AT/ATOOMIC/TimeDate-2.31.tar.gz ATOOMIC/TimeDate-2.31.tar.gz dmake -- NOT OK Running install for module 'Date::Parse' ATOOMIC/TimeDate-2.31.tar.gz Has already been unwrapped into directory C:\Perl64\cpan\build\TimeD +ate-2.31-4 ATOOMIC/TimeDate-2.31.tar.gz Has already been prepared ATOOMIC/TimeDate-2.31.tar.gz Could not make: Unknown error MARKOV/MailTools-2.21.tar.gz Has already been unwrapped into directory C:\Perl64\cpan\build\MailT +ools-2.21-4 MARKOV/MailTools-2.21.tar.gz Has already been prepared Running make for M/MA/MARKOV/MailTools-2.21.tar.gz Warning: Prerequisite 'Date::Format => 0' for 'MARKOV/MailTools-2.21.t +ar.gz' failed when processing 'ATOOMIC/TimeDate-2.31.tar.gz' with 'ma +ke => NO'. Continuing, but chances to succeed are limited. Warning: Prerequisite 'Date::Parse => 0' for 'MARKOV/MailTools-2.21.ta +r.gz' failed when processing 'ATOOMIC/TimeDate-2.31.tar.gz' with 'mak +e => NO'. Continuing, but chances to succeed are limited. MARKOV/MailTools-2.21.tar.gz dmake -- NOT OK RJBS/MIME-Lite-3.031.tar.gz Has already been unwrapped into directory C:\Perl64\cpan\build\MIME- +Lite-3.031-4 RJBS/MIME-Lite-3.031.tar.gz Has already been prepared Running make for R/RJ/RJBS/MIME-Lite-3.031.tar.gz Warning: Prerequisite 'Email::Date::Format => 1.000' for 'RJBS/MIME-Li +te-3.031.tar.gz' failed when processing 'RJBS/Email-Date-Format-1.005 +.tar.gz' with 'make => NO'. Continuing, but chances to succeed are li +mited. Warning: Prerequisite 'MIME::Types => 1.28' for 'RJBS/MIME-Lite-3.031. +tar.gz' failed when processing 'MARKOV/MIME-Types-2.17.tar.gz' with ' +make => NO'. Continuing, but chances to succeed are limited. Warning: Prerequisite 'Mail::Address => 1.62' for 'RJBS/MIME-Lite-3.03 +1.tar.gz' failed when processing 'MARKOV/MailTools-2.21.tar.gz' with +'make => NO'. Continuing, but chances to succeed are limited. RJBS/MIME-Lite-3.031.tar.gz dmake -- NOT OK

        As near as I can tell, it doesn't like that dmake fails to exist, but there are also missing prerequisites.

        Tried Strawberry perl, I like it but it doesn't include the Tkx libraries and I haven't been able to install them.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1143908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-03-28 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found