Ver Mensaje Individual
  #8 (permalink)  
Antiguo 17/09/2011, 05:52
toyeslomao
 
Fecha de Ingreso: diciembre-2010
Ubicación: tenerife
Mensajes: 60
Antigüedad: 13 años, 11 meses
Puntos: 0
error al envial email local

pues eso chicos q me sale error, os reporto codigo en 2 partes, yo uso mercury mail , no se si tendre que descargarme el sendmail
Código perl:
Ver original
  1. 1.Insecure $ENV{PATH} while running with -T switch at  line 7, line 1.
  2. #!/usr/bin/perl
  3. require 5.001;
  4.  
  5. $header        = "header.html";
  6. $footer        = "footer.html";
  7. $mailprogram   = "/usr/lib/sendmail -t";  MERCURY MAIL ???
  8. $returnpage    = "/";
  9. $youremail     = "freecart\@nopdesign.com";
  10. $csvfilename   = "orders.csv";
  11. $csvquote      = "\"\"";
  12. $mode          = "FILE";
  13.  
  14. @required = (
  15. 'b_first',
  16. 'b_last',
  17. 'b_addr',
  18. 'b_city',
  19. 'b_state',
  20. 'b_zip',
  21. 'b_phone',
  22. 'b_email'
  23. );
  24.  
  25. sub urlDecode {
  26.   my ($string) = @_;
  27.   $string =~ tr/+/ /;
  28.   $string =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex($1))/eg;
  29.   $string =~ s/['"]/\'/g;
  30.   return ($string);
  31. }
  32. sub processCGI {
  33.  local ($cgiData, $key, $value, $pair, @pairs);
  34.  
  35. if ($ENV{'REQUEST_METHOD'} eq 'GET') { $cgiData = $ENV{'QUERY_STRING'}; }
  36.   else { $cgiData = <STDIN>; }
  37.   @pairs = split (/&/, $cgiData);
  38.   foreach $pair (@pairs) {
  39.   ($key, $value) = split (/\=/, $pair);
  40.   $key   = &urlDecode($key);
  41.   $value = &urlDecode($value);
  42.   if(defined ${$key}){
  43.   ${$key} .= ", ".$value;
  44.   }else{
  45.   ${$key} = $value;
  46.       }
  47.    }
  48. }
  49. sub doFormError {
  50.  my ($errString) = @_;
  51.  
  52.  open (HEAD, $header);
  53.  @LINES = <HEAD>;
  54.  close HEAD;
  55.  
  56.  print "Content-type: text/html\n\n";
  57.  
  58.  print @LINES;
  59.  
  60.  print "<FONT SIZE=+2>The form you submitted was not complete.<BR><BR></FONT>";
  61.  print "$errString<BR><BR>\n";
  62.  print "<INPUT TYPE=BUTTON ONCLICK='history.back()' VALUE='  Return to the checkout page '><HR>";
  63.  
  64.     open (FOOT, $footer);
  65.     @LINES = <FOOT>;
  66.     close FOOT;
  67.     print @LINES;
  68.  
  69.     exit;
  70. }
  71.  
  72. sub doError {
  73.  my ($errString) = @_;
  74.  print "Content-type: text/html\n\n";
  75.  
  76.  open (HEAD, $header);
  77.  @LINES = <HEAD>;
  78.  close HEAD;
  79.  
  80.  print @LINES;
  81.  print "$errString<BR><BR>\n";
  82.  
  83.  open (FOOT, $footer);
  84.  @LINES = <FOOT>;
  85.  close FOOT;
  86.  print @LINES;
  87.  
  88.  exit;
  89.  
  90. sub invalidE {
  91.  my ($szEmail) = @_;
  92.  my ($user, $host);
  93.  
  94.  $szEmail =~ tr/A-Z/a-z/;
  95.  if ($szEmail =~ /\s/) { return 1; }
  96.  ($user, $host) = split (/\@/, $szEmail);
  97.  if ($host =~ /compuserve/i) { ; }
  98.  else {
  99.   if (! $user =~ /\D/) { return 1; }
  100.   if (! $host =~ /\D/) { return 1; }
  101.   if (substr ($user,0,1) !~ /[a-z]/) { return 1; }
  102. }
  103.  if ($szEmail =~ /\w+\@[\w|\.]/) { return 0; }
  104.  else { return 1; }
  105. }
  106. sub populateDateVar {
  107.  @months = ();
  108.  push(@months,"January");
  109.  push(@months,"February");
  110.  push(@months,"March");
  111.  push(@months,"April");
  112.  push(@months,"May");
  113.  push(@months,"June");
  114.  push(@months,"July");
  115.  push(@months,"August");
  116.  push(@months,"September");
  117.  push(@months,"October");
  118.  push(@months,"November");
  119.  push(@months,"December");
  120.  @days = ();
  121.  push(@days,"Sunday");
  122.  push(@days,"Monday");
  123.  push(@days,"Tuesday");
  124.  push(@days,"Wednesday");
  125.  push(@days,"Thursday");
  126.  push(@days,"Friday");
  127.  push(@days,"Saturday");
  128.  ($sec,$min,$hour,$day,$month,$year,$day2) =
  129.  (localtime(time))[0,1,2,3,4,5,6];
  130.  if ($sec < 10) { $sec = "0$sec"; }
  131.  if ($min < 10) { $min = "0$min"; }
  132.  if ($hour < 10) { $hour = "0$hour"; }
  133.  if ($day < 10) { $day = "0$day"; }
  134.  $year += "1900";
  135. &processCGI;
  136. &populateDateVar;
  137.  
  138. foreach $check(@required) {
  139.  unless ($check) {
  140.    doFormError("It appears that you forgot to fill in the <strong>$check</strong> field.");
  141.   exit;
  142.  }
  143. }
  144. if( &invalidE($b_email) ){
  145.    doFormError('su e-mail no es correcto.');
  146. }
  147.  
  148. if( $mode eq "BOTH" || $mode eq "EMAIL") {
  149.  
  150. open (MAIL,"|$mailprogram"); AKI ESTA EL ERROR
  151.  print MAIL "To: $youremail\n";
  152.  print MAIL "From: $b_email\n";
  153.  print MAIL "Subject: New Online Order\n";
  154.  print MAIL "\n\n";
  155.  print MAIL "A new order has been received.  A summary of this order appears below.\n";
  156.  print MAIL "\n";
  157.  print MAIL "Order Date: $months[$month] $day, $year $hour:$min:$sec \n";
  158.  print MAIL " \n";
  159.  print MAIL "Bill To: \n";
  160.  print MAIL "\n";
  161.  print MAIL "   $b_first $b_last \n";
  162.  print MAIL "   $b_addr \n";
  163.  print MAIL "   $b_addr2 \n";
  164.  print MAIL "   $b_city, $b_state  $b_zip \n";
  165.  print MAIL "   $b_phone \n";
  166.  print MAIL "   $b_fax \n";
  167.  print MAIL "   $b_email \n";
  168.  print MAIL " \n";
  169.  print MAIL " \n";
  170.  print MAIL "Ship To: \n";
  171.  print MAIL " \n";
  172.  print MAIL "   $s_first $s_last \n";
  173.  print MAIL "   $s_addr \n";
  174.  print MAIL "   $s_addr2 \n";
  175.  print MAIL "   $s_city, $s_state  $s_zip \n";
  176.  print MAIL "   $s_phone \n";
  177.  print MAIL " \n";
  178.  print MAIL " \n";
  179.  print MAIL "Qty  Price(\$)   Product ID  - Product Name\n";
  180.  print MAIL "\n";
  181.  print MAIL "$QUANTITY_1    \$$PRICE_1    $ID_1 - $NAME_1   $ADDTLINFO_1  \n";
  182.    if( $NAME_2 ) {print MAIL "$QUANTITY_2 \$$PRICE_2 $ID_2 - $NAME_2   $ADDTLINFO_2  \n";}
  183.    if( $NAME_3 ) {print MAIL "$QUANTITY_3 \$$PRICE_3 $ID_3 - $NAME_3   $ADDTLINFO_3  \n";}
  184.    if( $NAME_4 ) {print MAIL "$QUANTITY_4 \$$PRICE_4 $ID_4 - $NAME_4   $ADDTLINFO_4  \n";}
  185.    if( $NAME_5 ) {print MAIL "$QUANTITY_5 \$$PRICE_5 $ID_5 - $NAME_5   $ADDTLINFO_5  \n";}
  186.    if( $NAME_6 ) {print MAIL "$QUANTITY_6 \$$PRICE_6 $ID_6 - $NAME_6   $ADDTLINFO_6  \n";}
  187.    if( $NAME_7 ) {print MAIL "$QUANTITY_7 \$$PRICE_7 $ID_7 - $NAME_7   $ADDTLINFO_7  \n";}
  188.    if( $NAME_8 ) {print MAIL "$QUANTITY_8 \$$PRICE_8 $ID_8 - $NAME_8   $ADDTLINFO_8  \n";}
  189.    if( $NAME_9 ) {print MAIL "$QUANTITY_9 \$$PRICE_9 $ID_9 - $NAME_9   $ADDTLINFO_9  \n";}
  190.    if( $NAME_10 ){print MAIL "$QUANTITY_10 \$$PRICE_10  $ID_10 - $NAME_10   $ADDTLINFO_10 \n";}
  191.    if( $NAME_11 ){print MAIL "$QUANTITY_11 \$$PRICE_11    $ID_11 - $NAME_11   $ADDTLINFO_11 \n";}
  192.    if( $NAME_12 ){print MAIL "$QUANTITY_12 \$$PRICE_12    $ID_12 - $NAME_12   $ADDTLINFO_12 \n";}
  193.    if( $NAME_13 ){print MAIL "$QUANTITY_13 \$$PRICE_13    $ID_13 - $NAME_13   $ADDTLINFO_13 \n";}
  194. print MAIL "\n";
  195. print MAIL "SUBTOTAL: $SUBTOTAL \n";
  196. print MAIL "TOTAL: $TOTAL \n";
  197. print MAIL "\n";
  198. print MAIL "FREIGHT: $SHIPPING \n";
  199. print MAIL "\n\n";
  200. print MAIL "Comments: \n";
  201. print MAIL "\n";
  202. print MAIL "$comment \n";
  203. print MAIL " \n";
  204.  close MAIL;
  205. }
  206.  
  207. if( $mode eq "BOTH" || $mode eq "FILE") {