palkia has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone
Just tried the MIME::Lite module for the 1st time,
the download/install went "OK", but it got some weird error I can't figure out.
my (entire) code was:
use MIME::Lite; my $msg = MIME::Lite->new( From =>'some@one.com', To =>'realmail@gmail.com', #Cc =>'some@other.com, some@more.com', Subject =>'testing 1 2 3', Data =>"body thing, back slash n test\n, br ing test<br> thats i +t" ); $msg->send(); #this one is line 10
straight from the examples (cpan), of the module's page.
But when it Run, it just dies saying:
SMTP Failed to connect to mail server: Bad file descriptor at C:\Documents and Settings\Administrator\Desktop\perl experiments\m +ail sender.pl line 10 Press any key to continue . . .

so I added "use diagnostics;"
and this time it died saying:
Uncaught exception from user code: SMTP Failed to connect to mail server: Bad file descriptor at C:\Documents and Settings\Administrator\Desktop\perl experiments\m +ail sender .pl line 12 at C:/strawberry/perl/site/lib/MIME/Lite.pm line 2865 MIME::Lite::send_by_smtp('MIME::Lite=HASH(0xc9b62c)') called a +t C:/straw berry/perl/site/lib/MIME/Lite.pm line 2574 MIME::Lite::send('MIME::Lite=HASH(0xc9b62c)') called at C:\Doc +uments and Settings\Administrator\Desktop\perl experiments\mail sender.pl line 1 +2 Press any key to continue . . .

Any ideas ???
Thx

Replies are listed 'Best First'.
Re: Error upon "send()" with MIME::Lite (help please)
by Anonymous Monk on Sep 14, 2011 at 04:07 UTC
      thx
      after reading what you suggested I've reached the conclusion that I'm suppose to pre-set the sendmail somehow before use,
      as far as I can understand (after searching my computer for "sendmail.exe"),
      I need to refer to the path of my sendmail.exe, so I added
      MIME::Lite->send('sendmail', 'C:\\xampp\xampplite\sendmail\sendmail.exe');
      before the "my" line.
      it doesn't die not, but it prints/warns (not sure whats the difference),
      that: "sendmail.exe: no recipients found" (it does this with & without the "use diagnostics;").
      I used both a "from" and a "to" which actually exists so what does it want ?
      Also it printed that line way to fast for it to look as if it actually went online and got something back!

      Any more ideas ??? (please :~|)

        The MIME::Lite documentation for ->send specifically says:

        ... Or, for non-Unix users:
        MIME::Lite->send("smtp");

        Your code looks nothing like the documentation. It seems to me you are not on a unixish system, so maybe it would be a solution to use what the documentation says?