First -- your porgram is nowhere NEAR complete ... I see nowhere that
$to_address, $from_address, etc are populated.  Read the posting
guidelines and try again.

That being said, there are some glaring deficiencies that can be
pointed out even without the complete program.

> 
> my $picture=PATH OBTAINED FROM THE HTML FORM for example;  c:/a.jpg
> my $sendmailpath="/usr/sbin/sendmail";
> 
> open (SENDMAIL, "| $sendmailpath -t");
> print SENDMAIL "To: $to_address\n";
> print SENDMAIL "From: $from_address\n";
> print SENDMAIL "Subject: $subject\n\n";
> print SENDMAIL "$message_body";
> print SENDMAIL "\n\n";

Don't pipe to sendmail -- use one of the myriad convenient Perl
modules for sending email, with attachments etc.

MIME::Lite ismy favorite, there are many others just as good.  Try a
few and pick the one that fits your needs.

If $picture is a path obtained from a web form, it is probably a path
on the users computer, not your webserver (i.e. I find it near
impossible to imagine a computer whose sendmail is in /usr/sbin yet has
a directory in Apache's server_root named 'c:' and in this directory
is a file named a.jpg ).  

If you're not already (see that thing above about 'complete program')
using CGI.pm you should be, and you should go read the perldoc for the
file upload section a dozen times until you understand completely --
it is complicated and you'll get it wrong the first few times.

> open(FILE, "uuencode $picture $picture|");

Should you fall in love with MIME::Lite you won't need to fork out to
uuencode.  IF you insist on uuencoding (uuencode?  did I fall into a
timewarp to 1992?) yourself, it would be a good idea to include the
complete path, or at least show us that you explicitly set the path.

ALWAYS CHECK RETURN STATUS ON OPEN AND CLOSE.  A lot of people ignore
close() errors on files more often than they should, even me - it's a
common venial sin, but whenever reading from or writing to pipes
... well, just do it.  You'd have surely noticed that uuencode failed
catostrophically because it couldn't find a file with the bizarrely
formed filename c:/a.jpg in the current working directory.

> 
> Thanks
> Anish
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to