Ver Mensaje Individual
  #11 (permalink)  
Antiguo 21/10/2016, 19:00
el_loco90
 
Fecha de Ingreso: julio-2012
Mensajes: 234
Antigüedad: 12 años, 8 meses
Puntos: 9
Respuesta: Enviar url automatico al enviar un email

Cita:
Iniciado por Silenn Ver Mensaje
Explicame un poco, supongo que la url que quieres mandar dirige a un artículo en particular, desde dónde estás ejecutando el formulario?
Te explico:
Tengo varias postales realizada en flash ej http://portal.gdfemia.com.ar/web/est...lamistad1.html

Al enviar una postal ejecuta una llamada a enviodepostales.php
esto ejecuta
Código Javascript:
Ver original
  1. on (release) {
  2.     // Here we will validate the fields (make sure something was actually typed in)
  3.     if (!_root.nombre.length) {
  4.         _root.Status = "Por favor, ingrese su nombre";
  5.     } else {
  6.    
  7.             if (!_root.email.length || _root.Email.indexOf("@") == -1 || _root.Email.indexOf(".") == -1) {
  8.                 _root.Status = "Por favor, ingrese tu email";
  9.             } else {
  10.          if (!_root.receptor.length || _root.Receptor.indexOf("@") == -1 || _root.Receptor.indexOf(".") == -1) {
  11.                 _root.Status = "Por favor, ingrese el email del destinatario";
  12.         } else {
  13.                 if (!_root.mensaje.length) {
  14.                     _root.Status = "Por favor, escriba su mensaje";
  15.                 } else {
  16.  
  17.                     // Make sure to add any additional input fields here as well
  18.                     _root.Status = "La postal ha sido enviada";
  19.                     nombre = _root.nombre;
  20.                     email = _root.email;
  21.                     receptor = _root.receptor;
  22.                     consulta = _root.mensaje;
  23.                     loadVariablesNum("enviodepostales.php",0,'POST');
  24.                     _root.gotoAndPlay("submitted");
  25.                 }
  26.             }
  27.         }
  28.     }
  29. }
y el php se encarga de enviar el mensaje con la url de la postal
Código PHP:
Ver original
  1. <?php
  2. if ( isset($_POST[ 'nombre' ]) and !empty( $_POST[ 'nombre' ] ) ){  
  3.       $host= $_SERVER["HTTP_HOST"];
  4.       $url= $_SERVER["REQUEST_URI"];
  5.       $para = $_POST['receptor'];
  6.       $asunto = "Postal enviada por tu amigo/a desde gdfemia.com.ar";
  7.       $nombre = $_POST['nombre'];
  8.       $mail = $_POST['email'];
  9.       $link = $_POST['link'];
  10.       $consulta = $_POST['consulta'];
  11.       $mensaje = "Este mensaje fue enviado por " . $nombre . " \r\n";
  12.       $mensaje .= " Te han enviado una postal, para verla entra a " . $link . " http:// " . $host . $url;
  13.       $mensaje .= " El email de su amigo es: " . $mail . " \r\n";
  14.       $mensaje .= " Mensaje: " . $consulta . " \r\n";
  15.       $mensaje .= " Enviado el " . date('d/m/Y', time());
  16.       $cabeceras = 'From: [email protected]' . "\r\n" .
  17.        'Reply-To: [email protected]' . "\r\n" .
  18.        'X-Mailer: PHP/' . phpversion();
  19.       $mensaje = wordwrap($mensaje, 70);
  20.       ini_set(sendmail_from,'[email protected]');
  21.       mail($para, $asunto, utf8_decode($mensaje), $cabeceras);
  22.       ?>
  23.       <?php
  24. }
  25. ?>

y ahí en ver de enviar http://portal.gdfemia.com.ar/web/est...lamistad1.html me envía http://
portal.gdfemia.com.ar/web/estatica/enviodepostales.php

es decir
http://
portal.gdfemia.com.ar/web/estatica/ -> hasta aca me manda bien
http://
portal.gdfemia.com.ar/web/estatica/enviodepostales.php -> en vez de mandarme la terminación de la url que seria postalamistad1.html, me manda enviodepostales.php que es el código php que uso para enviar