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

Hi all

I am facing some problem when run the perl code. I am using MIME::Lite module to send the mail with attachment.

Its working FINE under LINUX machine.
When I run the same code under WINDOWS NT, I am getting Error as "sendmail' is not recognized as an internal or external command, operable program or batch file"

Here is my code
use MIME::Lite; my $msg=MIME::Lite->new ( Subject => Test Program', From => $from, To => $to, Type => 'multipart/mixed', ); ### Add the text message part $msg->attach ( Type => 'TEXT', Data => $message_part ) or die "Error adding the text message part: $!\n"; ### Add the csv file $msg->attach ( Type => 'text/xls', Path => "$csv_file", Filename => $filename, Disposition => 'attachment' ) or die "Error in attaching $filename : $!\n"; $msg->send();
Can anyone please help me to resolve this issue
what code do I need to add

Thanks

Replies are listed 'Best First'.
Re: Using MIME::Lite on Windows
by FunkyMonk (Bishop) on Oct 06, 2007 at 10:08 UTC
    You don't have a program called sendmail installed on your windows box.

    A brief search of MIME::Lite suggests...

    ### Do something like this in your 'main': if ($I_DONT_HAVE_SENDMAIL) { MIME::Lite->send('smtp', $host, Timeout=>60 AuthUser=>$user, AuthPass=>$pass); }

    Update Super Search will find many examples of using MIME::Lite on Windows.

Re: Using MIME::Lite on Windows
by genyded (Novice) on Oct 06, 2007 at 12:45 UTC
    Check out http://www.perlmonks.org/?node_id=609130
    It has some proposed alternatives and links to other applicable information. You probably going to have to tailor sending mail based on the system you are on or type of email server.

    You may even need to prompt users for some information first depending on what your ultimate goal is.