Gossamer Forum
Home : General : Perl Programming :

pipe problem

Quote Reply
pipe problem
This looks very stranger. the all message has been downloaded. below part seems work well. while it seems it did not correctly pipe to email.cgi.

#it seems that there is no value passed to @to_addresses ( email.cgi) so it alway print out 11111111111##



What problem it has? as this problem has been asking many time in perldesk forum but no reponse from their support staff even you send inqiry email to them. this is really upset me after you pay the programme and no support got.

####POP_email.cgi

for (my $i = 1; $i <= $pop_server->Count(); $i++)
{
$PIPE_FILE = "G:/testsite/cgi-bin/perldesk/cgi-bin/include/email.cgi"; # EMAIL.CGI FILE
open PERLDESK, "| $PIPE_FILE"
or die "Sorry, I was unable to open the email.cgi file: $!";

local $SIG{PIPE} = sub { die "PERLDESK pipe broken" };

my $line = $pop_server->HeadAndBody($i);

print PERLDESK $line;
## $pop_server->Delete($i);

close PERLDESK or die "Could Not Close PIPE: $!";
}

$pop_server->Close() or die "Error closing connection: $!";

print "$total Emails Downloaded from $ref->{'pop_user'} \@ $ref->{'pop_host'}\n";
}







#####email.cgi

use CGI qw(:standard);
use DBI();

use MIME::Parser;
use Mail::Address;
use MIME::Entity;
use MIME::Body;
use Data::Dumper;
#~~ No further editing required

use CGI qw(:standard);
use DBI();

use MIME::Parser;
use Mail::Address;
use MIME::Entity;
use MIME::Body;
use Data::Dumper;


&get_time();

$parser = new MIME::Parser;
$parser->ignore_errors(1);
$parser->output_to_core(1);



my $MIME_entity = $parser->parse(\*STDIN);
my $error = ($@ || $parser->last_error);

$header = $MIME_entity->head;
$subject = $header->get('Subject') || "no subject";
$cto = $header->get('To');
$from = $header->get('From');

$priority = $header->get('X-Priority');
$priority = "3" if $priority eq "N";

@to_addresses = Mail::Address->parse($cto);
@from_addresses = Mail::Address->parse($from);

my $address;

#####################please see here

#it seems that there is #

#no value passed to @to_addresses so it ##

## alway print out 11111111111##

#############################

if (@to_addresses) { $to = $to_addresses[0]->address(); }
else { print " 11111111111 \n"; exit; }

if (@from_addresses) {
$address = $from_addresses[0]->address();
if($address eq 'MAILER-DAEMON') { exit; }
}
else { exit; }


$id = 0;
Quote Reply
Re: [courierb] pipe problem In reply to
Looks like maybe the email.cgi script can't grab STDIN or the parsing is failing. I'm afraid though its going to have to be solved by perldesk.

The best advice I think I can give is to print $error.
Quote Reply
Re: [Paul] pipe problem In reply to
Thanks Paul. i agree with your analysis. I do know it should be solved by perldesk support staff . unfortunately there is no reponse from them. seems they do not willing to answered the support inquiry. there are so many case of this problem even no offical reply from them.



I just want to post here to see if any one could help me.




By the way there is no major error how to print $error.




Thanks

Last edited by:

courierb: Jun 7, 2003, 3:28 AM