Mail Handling

First of all, a happy 2000 to you all.

second, in my continuing quest ;) of mailing attachements with sendmail and perl...

I use the following script:

#!/usr/bin/perl

use MIME::Lite;
         
     $top = build MIME::Lite   Type    => "multipart/mixed",
                               From    => "test@hab.nl",
                               To      => "j.brugman@hab.nl",
                               Subject => "Hello, nurse!";
     
     attach $top  Path=>"test.html";
     
     $sendmail  = '/usr/sbin/sendmail';
     open(MAIL, "|$sendmail -t");
     $top->print(\*MAIL);
     close MAIL;

(chmod 755)
When trying to test i get the following error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

Premature end of script headers: test.cgi


What could be wrong now and how do i solve it.

LVL 4
jbrugmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

monasCommented:
If you run this script as a cgi-script - then it MUST produce some web-page! Even empty one. So try to add

print "Content-Type: text/plain\n\n";

before use MIME::Lite;
0
jbrugmanAuthor Commented:
Done, Script is now:

#!/usr/bin/perl
print "Content-Type: text/plain\n\n";

use MIME::Lite;

$top = build MIME::Lite   Type    => "multipart/mixed",
                          From    => "test@hab.nl",
                          To      => "j.brugman@hab.nl",
                          Subject => "Hello, nurse!";
 
attach $top  Path=>"test.html";

$sendmail  = '/usr/sbin/sendmail';
open(MAIL, "|$sendmail -t");
$top->print(\*MAIL);
close MAIL;

but the server-error is still the same.
0
struppiCommented:
is mime::Lite a standard libary ? in my version there are no.
may you must transfer the lite.pm file (in the perl/lib/mime/lite path, i guess) in your working directory and try to use it as "use Lite.pm".
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

KennyIT Application ExecutiveCommented:
Perhaps you can try changing your double quotes (") to single quotes (') because of the special characters in the email address (@,.).
0
monasCommented:
did you try to run this without web server. Try to log into web server and run it ./script.cgi

I bet perl will say you that you need \ before every @ in email addresses...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jbrugmanAuthor Commented:
Together with your first command, and the last, i made it work!!!
I'm verry happy now :-))
0
jbrugmanAuthor Commented:
Done, Script is now:

#!/usr/bin/perl
print "Content-Type: text/plain\n\n";

use MIME::Lite;

$top = build MIME::Lite   Type    => "multipart/mixed",
                          From    => "test\@hab.nl",
                          To      => "j.brugman\@hab.nl",
                          Subject => "Hello, nurse!";
   
attach $top  Path=>"test.html";

$sendmail  = '/usr/sbin/sendmail';
open(MAIL, "|$sendmail -t");
$top->print(\*MAIL);
close MAIL;

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.