Ver Mensaje Individual
  #14 (permalink)  
Antiguo 28/08/2011, 08:03
marx-pola
 
Fecha de Ingreso: mayo-2002
Ubicación: Capital Federal
Mensajes: 630
Antigüedad: 22 años
Puntos: 1
Respuesta: Carrito de Compras - Cómo se envía por email el listado que se cargó?

Nonononoo!!!! Me sigue duplicando los emails.

A ver si me dan una mano porfa.... a ver dnd esta el error:
Código PHP:
session_start();
error_reporting(E_ALL);
@
ini_set('display_errors''1');
if(isset(
$_SESSION['carro']))
$carro=$_SESSION['carro'];else $carro=false;

if (
$_POST['enviar'] != "") {

require_once(
'phpmailer/class.phpmailer.php');
require_once(
"phpmailer/class.smtp.php");

$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->Helo "www.misitio.com.ar"//Muy importante para que llegue a hotmail y otros
$mail->IsSendmail(); // telling the class to use SendMail transport
$mail->SetFrom('[email protected]''Quiero Comprar');
//$mail->AddReplyTo("[email protected]","First Last");
$address "[email protected]";
$mail->AddAddress($address"Pedido");
$mail->Subject "Carrito de Compras Online";

$mail->IsHTML(true);

if(
$carro){

$body  'CARRITO DE COMPRAS'
//$body .= " mensaje de prueba"; 
    
$body .= '<table width="399" border="1">
    <tr>
    <td width="64" height="20">Producto</td>
    <td width="236">Categoria</td>
    <td width="204">Linea</td>
    <td width="82" height="20">Precio</td>
    <td height="20" colspan="2" align="center">Cantidad de Unidades</td>
    </tr>'
;
  
$color=array("#ffffff","#F0F0F0");
  
$contador=0;
  
$suma=0;
//  $sumar1=count($carro);
   
foreach($carro as $k => $v){
   
$subto=$v['cantidad']*$v['precio'];
   
$suma=$suma+$subto;
   
$contador++;
    
$body .= '<tr>
    <td height="20">'
.$v['id_articulo'].'</td>
      <td height="20">'
.$v['categoria'].'</td>
      <td height="20">'
.$v['linea'].'</td>
      <td height="20">'
.$v['precio'].'</td>
      <td width="45" height="20" align="center">'
.$v['cantidad'].'</td>
    </tr>'
;
    }
  }

  
$contador2=0;
  
$suma2=0;
  foreach(
$carro as $k => $v)
  {
   
$subto=$v['cantidad'];
   
$suma2=$suma2+$subto;
   
$contador2++;
    }
    
$body .= '<table width="399" border="1">
    <tr>
    <td height="20"><span class="prod">Total de Productos Seleccionados: '
.count($carro).'</span></td>
    <td height="20"><span class="prod">Importe a Abonar: '
.number_format($suma,2).'</span></td>
    </tr>
    </table>'
;
  
$mail->Body $body

$mail->Send(); 

// Notificamos al usuario del estado del mensaje 
if(!$mail->Send()){ 
//   echo "No se pudo enviar el Mensaje.";
   
echo "<br/>".$mail->ErrorInfo//Esto te muestra el error que ha producido al intentar enviar el correo  
}else{ 
   echo 
"Mensaje enviado exitosamente."


¿Qué hace que me lleguen 2 veces el email?
__________________
"Todo lo que somos es el resultado de lo que hemos pensado". Budda.