pipe to |/home/user/main_files/email.pl generated by registration@domain.com local delivery failed #### use CGI qw(:standard); use Mail::Address; use MIME::Parser; use MIME::Entity; use MIME::Body; use Data::Dumper; use Mail::Sendmail; use Email::DB; # All these changed for demo purposes only $dbh = Email::DB::connect(); $_req_dir = '/home/user/main_files'; # Changed, for demo purposes. require "$_req_dir/vars.conf"; get_site_values(); # loaded from vars.conf above. %vars = Get_Page_Vars(\%vars,"subscribe_page_vars"); # Also loaded from vars.conf print header(-type=>"plain/text"); # I have NO Idea why I did this :o), tried it with and without, still same error :o( $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'); $from = $header->get('From'); $cto = $header->get('To'); @to_addresses = Mail::Address->parse($cto); @from_addresses = Mail::Address->parse($from); my $address; if (@to_addresses) { $to = $to_addresses[0]->address(); } else { exit; } if (@from_addresses) { $from = $from_addresses[0]->address(); } else { exit; } if ($MIME_entity->parts > 0) { for (my $i=0;$i<$MIME_entity->parts;$i++) { my $subEntity = $MIME_entity->parts($i); my $ignore_plain = 0; my $ignore_html = 0; $ishtml = "1" if $subEntity->mime_type eq 'text/html'; $ishtml = "0" if $subEntity->mime_type eq 'text/plain'; if (($subEntity->mime_type eq 'text/html') && ($ignore_html == 0)) { if (my $io = $subEntity->open("r")) { while (defined($_=$io->getline)) { $_ =~ s/"/\"/g; $body .= $_; } $io->close; $ignore_plain=1; } } if (($subEntity->mime_type eq 'text/plain') && ($ignore_plain=0)) { if (my $io = $subEntity->open("r")) { while (defined($_=$io->getline)) { $_ =~ s/"/\"/g; $body .= $_; } $io->close; $ignore_html=1; } } } } else { $body = join "", @{$MIME_entity->body}; } $to = $1 if $to =~ /<(\S+)>/; if ($from =~ /<(\S+)>/) { $newfrom = $1 } else { $newfrom = $from } $body =~ s/"/\"/g; if (($subject =~ /^(remove|unsubscribe)/i) || ($to =~ /(remove|removal|unsubscribe)/i)) { UnSubscribe_User($from); } elsif ($subject =~ /\|/) { Subject_Parser($subject); } else { die "Could not run script! $!"; exit; }