use Mail::Address; use Getopt::Long; use MOJO::Config; # configuration variables use MOJO::Mail::Send; # use the MOJO::Mail::Send module to send e-mails with use MOJO::App::Guts; # use MOJO::Guts for misc subroutines use MOJO::MailingList::Subscribers; use strict; # get header, footer my $header; my $body; { local $/ = ""; $header = ; undef $/; $body = ; } my $test = 0; GetOptions("test" => \$test); #create a MOJO::Mail::Send object my $mh = MOJO::Mail::Send->new(); #get headers in name=>value pair my %mail_headers = $mh->return_headers($header); # 'normalize' the headers %mail_headers = $mh->clean_headers(%mail_headers); # extract 'To:' addresses my @To_addresses = Mail::Address->parse($mail_headers{To}); # extract anything in the CC: header my @Cc_addresses = Mail::Address->parse($mail_headers{Cc}); # plop them together @To_addresses = (@To_addresses, @Cc_addresses); # extract the 'From:' address my $From_address = (Mail::Address->parse($mail_headers{From}))[0]; my $from_to_check = 0; foreach my $this_address(@To_addresses){ my $from_test = $From_address->address; if($this_address->address =~ /$from_test/i){ $from_to_check = 1; last; } } if($from_to_check == 1){ warn("$PROGRAM_NAME $VER ERROR, quitting script to stop possible infinite loop!"); exit; } # at this point is where I need the vars to post. Make sense? Obviously, we would not need to use all of the above modules/libraries # the mojo script goes on and on to process emails as it would, but we wish to avoid that so here we would execute the lines mentioned by Roger. # build variables to pass to PHP via post my %vars = ( var1 => $var1, # the email vars would be here I believe? var2 => $var2, # ... ); # then we would do the post thing # send the POST to php my $url = "http://domain.com/test.php"; my $req = new HTTP::Request; my $res = $us->post($url, \%vars);