Foros del Web » Programando para Internet » PHP »

Duda con funcion mail()

Estas en el tema de Duda con funcion mail() en el foro de PHP en Foros del Web. estoy utilizando.. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código PHP: Ver original mail ( $mail , $subjet , $mensaje , $header ) ; todo bien.. la cosa es no ...
  #1 (permalink)  
Antiguo 05/08/2011, 11:15
 
Fecha de Ingreso: mayo-2011
Mensajes: 167
Antigüedad: 12 años, 11 meses
Puntos: 1
Duda con funcion mail()

estoy utilizando..
Código PHP:
Ver original
  1. mail($mail, $subjet, $mensaje, $header);

todo bien.. la cosa es no se como hacer para que la variable $mensaje sea tan grande como quisiera...

por ejemplo quiero que el mensaje sea todo esto...

Código PHP:
Ver original
  1. <div style="height:100%;">
  2. <?
  3. function add_ceros($numero,$ceros) {
  4. $order_diez = explode(".",$numero);
  5. $dif_diez = $ceros - strlen($order_diez[0]);
  6. for($m = 0 ;
  7. $m < $dif_diez;
  8. $m++)
  9. {
  10. @$insertar_ceros .= 0;
  11. }
  12. return $insertar_ceros .= $numero;
  13. }
  14. ?>
  15.   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  16.     <tr>
  17.       <td><img src="../evolucion/logote.gif" alt="www.europrint.com.mx" width="376" height="112" /></td>
  18.       <td align="right" valign="top"><span style="font-family:'Courier New', Courier, monospace; color:#F00; font-weight:900;">No <?php echo add_ceros($cotizacion_no,4); ?></span></td>
  19.     </tr>
  20.   </table>
  21.  
  22.   <p align="right">
  23.     <?php setlocale(LC_TIME, 'es_MX');
  24. if (isset($_POST['nombre'])) { echo "Ocotlán, Jalisco a ".$fecha=strftime('%d de %B de %Y',strtotime($_POST['fecha']))."<br />"; } ?>
  25.   </p>
  26.   <div align="center">
  27.     <h3><strong>COTIZACIÓN</strong></h3>
  28.   </div>
  29.   <p>
  30.     <?php if ($_POST['nombre'] == "") {} else { echo $_POST['nombre']."<br />"; } ?>
  31.     <?php if ($_POST['razon_social'] == "") {} else { echo "RAZON SOCIAL: ".$_POST['razon_social']."<br />"; } ?>
  32.     <?php if ($_POST['email'] == "") {} else { echo "EMAIL: ".$_POST['email']."<br />"; } ?>
  33.     <?php if ($_POST['telefono'] == "") {} else { echo "TELEFONO: ".$_POST['telefono']."<br />"; } ?>
  34.     <br />
  35.    
  36. <?php
  37. $result = count($_POST['cantidad'])-1;
  38. $i = 0;
  39. while($i <= $result) {
  40.  
  41. echo "<strong>$descripcion[$i]</strong><br />";
  42. echo "<em>CANTIDAD:</em>*".$cantidad[$i]."<br />";
  43. echo "<em>PRECIO UNITARIO:</em> ".number_format($precio[$i], 2, ".", ",")."<br />";
  44.  
  45. $fuck[]=$cantidad[$i]*$precio[$i];
  46.   ++$i; // Esta instrucción hace que el valor de $i se incremente en 1
  47. }
  48. ?>
  49.    
  50.   </p>
  51. <p>    <strong><?php echo number_format($sub, 2, ".", ","); ?> COSTO SIN I.V.A.<br />
  52.       <?php echo number_format($iva, 2, ".", ","); ?> 16% I.V.A.<br />
  53.       <?php echo number_format($total, 2, ".", ","); ?> COSTO TOTAL INCLUYENDO I.V.A.<br />
  54.     </strong><span style="text-transform:uppercase;">(<?php
  55.               list($entero, $decimal)=split('[/.-]',number_format($total, 2, ".", ","));
  56.               echo ucfirst(strtolower(docenumeros(number_format($total, 2, ".", ",")))) ?> pesos <?php echo $decimal ?>/100 M.N.)</span><br />
  57.     <br />
  58.     CUALQUIER DUDA Y/O COMENTARIO, ESTOY A SUS ÓRDENES...<br />
  59.     <br />
  60.     <br />
  61.     <span class="UNO" style="color:#900">ATENTAMENTE</span><br />
  62.   </p>
  63.   <div style="font-size:10px;">JUAN MANUEL GUTIERREZ TERRAZAS<br />
  64.     DIRECTOR<br />
  65.     <br />
  66.     VISÍTANOS EN<br />
  67.     <strong>www.elcapitolio.com.mx</strong><br />
  68.     MADERO 343
  69.     COL. CENTRO 47800 OCOTLAN, JAL., MX.<br />
  70.     <strong>PHONE*</strong><strong><strong>(392) 922-1210</strong>       CALL FREE*<strong>01800-700-CAPI</strong><br />
  71.     <br />
  72.       SOMOS UNA EMPRESA RESPONSABLE Y TENEMOS UN ALTO COMPROMISO CON LA SOCIEDAD.<br />
  73.     <strong>CON TUS COMENTARIOS PODEMOS MEJORAR NUESTRO SERVICIO, ESCRÍBENOS A:*</strong><span style="color:#900; font-size:12px;">[email protected]</span><br />
  74.       INFORMACIÓN CONFIDENCIAL LEGALMENTE PROTEGIDA / CONFIDENTIAL INFORMATION LEGALLY PRIVILEGED.<br />
  75.   ELCAPITOLIO.COM.MX&reg; ES  MARCA REGISTRADA.</strong></div>
  76. </div>


como le puedo hacer?
  #2 (permalink)  
Antiguo 05/08/2011, 11:56
Colaborador
 
Fecha de Ingreso: mayo-2008
Ubicación: $MX['VZ']['Xalapa']
Mensajes: 3.005
Antigüedad: 15 años, 11 meses
Puntos: 528
Respuesta: Duda con funcion mail()

En principio, la variable será tan grande como la definas, en tu caso en vez de hacer echo, debes ir agregando la información a una variable, ejemplo:
en vez de:


Código PHP:
Ver original
  1. echo "<strong>$descripcion[$i]</strong><br />";
  2. echo "<em>CANTIDAD:</em>*".$cantidad[$i]."<br />";
  3. echo "<em>PRECIO UNITARIO:</em> ".number_format($precio[$i], 2, ".", ",")."<br />";

harías:
Código PHP:
Ver original
  1. $mensaje="<strong>$descripcion[$i]</strong><br />
  2. <em>CANTIDAD:</em>*".$cantidad[$i]."<br />
  3. <em>PRECIO UNITARIO:</em> ".number_format($precio[$i], 2, ".", ",")."<br />";
Y así puedes ir agregando el contenido a la variable mensaje:
$mensaje.="mas contenido";

Por otra parte, como sugerencia si puedes usa phpmailer, que te facilitará mucho el manejo de correo
  #3 (permalink)  
Antiguo 05/08/2011, 12:06
 
Fecha de Ingreso: mayo-2011
Mensajes: 167
Antigüedad: 12 años, 11 meses
Puntos: 1
Respuesta: Duda con funcion mail()

Gracias por la ayuda.. donde puedo leer mas acerca de phpmailer?
  #4 (permalink)  
Antiguo 05/08/2011, 12:54
Avatar de Proal_Sordel  
Fecha de Ingreso: octubre-2007
Ubicación: San Rafael, Vercruz, México
Mensajes: 1
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: Duda con funcion mail()

lo que podrias hacer es ingresar en una variable todo el mensaje

ejemplo

$shtml = "<table width=700 align=center bgcolor=#FFFFFF><font size=1 face=Verdana color=#0000ff>";
$shtml = $shtml . "<tr><td><img src='http://www.misitio.com/imagenes/logo.jpg' height=40></td><td align=right>$hoy</td></tr>";


aunque te recomiendo que le des una buena leida al phpmailer, es muy facil de utilizar.

[URL="http://www.programacion.com/articulo/uso_de_la_clase_phpmailer_213"]aqui puedes encontrar mas informacion[/URL]
  #5 (permalink)  
Antiguo 05/08/2011, 18:40
 
Fecha de Ingreso: mayo-2011
Mensajes: 167
Antigüedad: 12 años, 11 meses
Puntos: 1
Respuesta: Duda con funcion mail()

es valido esto que estoy haciendo??
como meter los if dentro de las variables?

Código PHP:
Ver original
  1. <?php
  2. $mensaje='<div style="height:100%;">
  3. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  4. <tr>
  5. <td><img src="../evolucion/logote.gif" alt="www.elcapitolio.com.mx" width="376" height="112" /></td>
  6. <td align="right" valign="top"><span style="font-family:Courier, monospace; color:#F00; font-weight:900;">No '.add_ceros($cotizacion_no,4).'</span></td>
  7. </tr>
  8. </table>
  9.  
  10. <p align="right">
  11. '.if (isset($_POST['nombre'])) { echo "Ocotlán, Jalisco a ".$fecha=strftime('%d de %B de %Y',strtotime($_POST['fecha']))."<br />"; } .'
  12. </p>
  13. <div align="center">
  14. <h3><strong>COTIZACIÓN</strong></h3>
  15. </div>
  16. <p>
  17. '.if ($_POST['nombre'] == "") {} else { echo $_POST['nombre']."<br />"; } .'
  18. '.if ($_POST['razon_social'] == "") {} else { echo "RAZON SOCIAL: ".$_POST['razon_social']."<br />"; } .'
  19. '.if ($_POST['email'] == "") {} else { echo "EMAIL: ".$_POST['email']."<br />"; } .'
  20. '.if ($_POST['telefono'] == "") {} else { echo "TELEFONO: ".$_POST['telefono']."<br />"; } .'
  21. <br />  
  22. <?php
  23. $result = count($_POST['cantidad'])-1;
  24. $i = 0;
  25. while($i <= $result) {
  26. echo "<strong>$descripcion[$i]</strong><br />";
  27. echo "<em>CANTIDAD:</em>*".$cantidad[$i]."<br />";
  28. echo "<em>PRECIO UNITARIO:</em> ".number_format($precio[$i], 2, ".", ",")."<br />";
  29. $fuck[]=$cantidad[$i]*$precio[$i];
  30.  ++$i; // Esta instrucción hace que el valor de $i se incremente en 1
  31. }
  32. ?>
  33. </p>
  34. <p>
  35. <strong><?php echo number_format($sub, 2, ".", ","); ?> COSTO SIN I.V.A.<br />
  36. <?php echo number_format($iva, 2, ".", ","); ?> 16% I.V.A.<br />
  37. <?php echo number_format($total, 2, ".", ","); ?> COSTO TOTAL INCLUYENDO I.V.A.<br />
  38. </strong><span style="text-transform:uppercase;">(<?php
  39. list($entero, $decimal)=split('[/.-]',number_format($total, 2, ".", ","));
  40. echo ucfirst(strtolower(docenumeros(number_format($total, 2, ".", ",")))) ?> pesos <?php echo $decimal ?>/100 M.N.)</span><br />
  41.    <br />
  42.    CUALQUIER DUDA Y/O COMENTARIO, ESTOY A SUS ÓRDENES...<br />
  43.    <br />
  44.    <br />
  45.    <span class="UNO" style="color:#900">ATENTAMENTE</span><br />
  46.  </p>
  47.  <div style="font-size:10px;">JUAN MANUEL GUTIERREZ TERRAZAS<br />
  48.    DIRECTOR<br />
  49.    <br />
  50.    VISÍTANOS EN<br />
  51.    <strong>www.elcapitolio.com.mx</strong><br />
  52.    MADERO 343
  53.    COL. CENTRO 47800 OCOTLAN, JAL., MX.<br />
  54.    <strong>PHONE*</strong><strong><strong>(392) 922-1210</strong>       CALL FREE*<strong>01800-700-CAPI</strong><br />
  55.    <br />
  56.      SOMOS UNA EMPRESA RESPONSABLE Y TENEMOS UN ALTO COMPROMISO CON LA SOCIEDAD.<br />
  57.    <strong>CON TUS COMENTARIOS PODEMOS MEJORAR NUESTRO SERVICIO, ESCRÍBENOS A:*</strong><span style="color:#900; font-size:12px;">[email protected]</span><br />
  58.      INFORMACIÓN CONFIDENCIAL LEGALMENTE PROTEGIDA / CONFIDENTIAL INFORMATION LEGALLY PRIVILEGED.<br />
  59.  ELCAPITOLIO.COM.MX&reg; ES  MARCA REGISTRADA.</strong></div>
  60. </div>';
  61. ?>

creo q no vdd??
  #6 (permalink)  
Antiguo 06/08/2011, 08:47
 
Fecha de Ingreso: marzo-2011
Mensajes: 226
Antigüedad: 13 años, 1 mes
Puntos: 1
Respuesta: Duda con funcion mail()

phpmailer tiene su propia web, busca en google y te aparecera, usar phpmailer es lo mas facil q hay ademas hay miles de blogs q indican como se configura o sino en este mismo foro hay codigo echo con phpmailer y gmail q funciona a la perfeccion

Etiquetas: funcion, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:49.