Jump to content

email function Probs


juanza

Recommended Posts

Hi, i am having some troubles with the mail() function i have my webpage upload at godaddy and when i try to send messages with this functions sometimes they are sent and sometimes they are not, i have no idea what to do now i will put my code here pls pls pls help i dont know what could it be :( .

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Contactar</title>
<link href="CoLibs/stylePrincipal.css" rel="stylesheet" type="text/css" />
<link href="CoLibs/styleMenu.css" rel="stylesheet" type="text/css" />
<link href="CoLibs/class.css" rel="stylesheet" type="text/css" />
<script src="CoLibs/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="CoLibs/SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
<link href="CoLibs/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<link href="CoLibs/SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />

<script src="CoLibs/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="CoLibs/javascript.js" type="text/javascript"></script>

<style type="text/css">
#nomenu2, #menuCasas, #menuTerrenos, #menuComercial, #menuIndustrial{
float:right;
}
</style>
</head>

<body>


<div id="contenidoCentro" class="grid_9 texto" style="text-align:right;" >       
  <div class="contenidoFavoritos esquinaRedonda" >
			<div class="superiorCentro" > Contacta al propietario</div> 
			<br />
                 <img src="imagenes/enviarAmigo/icono-mail.png" style="margin:20px; float:left; margin-top:40px" />
			<br />
                <?php 
			if ($_POST["email"]<>'') { 

				include_once("conexion.php");
				$conexion = new Conexion();
				$query = "SELECT correo, nombreCliente FROM cliente WHERE (".$_POST['cliente']."= idCliente)";
				$resultado = mysql_query($query, $conexion->getLink());
				if(mysql_num_rows($resultado) > 0) {
				$renglon = mysql_fetch_assoc($resultado);

				$ToEmail = $renglon['correo']; 
				$EmailSubject = 'Comentarios sobre su propiedad #'.$_POST['propiedad']; 
				$mailheader = "From: ".$_POST["email"]."\r\n"; 
				$mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; 
				$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
				//$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>"; 
				//$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>"; 
				//$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."<br>"; 
				$MESSAGE_BODY .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
@import {
font-family: Myriad Pro;
src: url("fonts/MyriadPro-BoldCondIt.otf");
}
#apDiv1 {
position:absolute;
left:245px;
top:113px;
width:321px;
height:37px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:640px;
top:117px;
width:452px;
height:252px;
z-index:2;
}
.style1 {
font-family: "Myriad Pro";
font-size: 14px;
}
.style4 {
font-family: "Myriad Pro";
font-size: 11px;
color: #6C6C6C;
}
.style2 {
font-family: "Myriad Pro";
font-size:16px;
font-weight: bold;
right:auto;
}
.style3 {font-family: "Myriad Pro"; font-size: 13px; font-weight: bold; }
#apDiv3 {
position:absolute;
left:373px;
top:316px;
width:106px;
height:58px;
z-index:3;
}
#apDiv4 {
position:absolute;
left:384px;
top:430px;
width:133px;
height:24px;
z-index:4;
}
-->
</style>
</head>

<body>
<table width="560" height="502" border="0" background="http://ubicacionideal.com/Final/mail/recuadro-email.png">
  <tr>
    <td height="136" colspan="2" rowspan="2" valign="top" scope="col"><p> </p>
    <p> </p>
    <p> </p>    </td>
    <td width="7" height="136" rowspan="2" valign="top" scope="col"><p> </p>
    <p> </p>
    <p> </p>    </td>
    <td width="256" height="97" valign="top" scope="col"><p> </p>
    <p> </p>
    <p> </p>
    </td>
  </tr>
  <tr>
    <td height="22" valign="top" scope="col"><div align="center" class="style2">
      <div align="right">¡Te han contactado através del sitio!</div>
    </div></td>
  </tr>
  <tr>
    <td height="207" valign="top" scope="col"> </td>
    <td height="207" colspan="3" valign="top" scope="col"><p class="style1"> </p>
      <p class="style1">Hola '.$renglon['nombreCliente'].',</p>
      <p class="style1"><strong>'.$_POST["name"].'</strong> ha revisado tu propiedad y tiene los siguientes comentarios: </p>
      <p class="style1">"'.nl2br($_POST["comment"]).'"</p>    </td>
  </tr>
  <tr>
  <td> </td>
  <td><p class="style3">¡Te esperamos!</p>
    <p class="style4">-Equipo de Ubicación Ideal</p></td>
    <td height="44" colspan="2" valign="top" scope="col"><div>
      <p align="right" class="style4"><a href="http://ubicacionideal.com/Final/inboxMail.php"><img src="http://ubicacionideal.com/Final/mail/boton--ubicalizalo.png" width="135" height="42" border="0" /></a></p>
      <p align="right" class="style4">Haz click para entrar</p>
    </div>    </td>
    <td width="59" rowspan="2" valign="top" scope="col"></td>
  </tr>
  <tr>
    <td width="59" height="42" valign="top" scope="col"> </td>
    <td width="159" valign="top" scope="col"><div align="center"></div></td>
    <td valign="top" scope="col" colspan="2"> </td>
  </tr>
  <td height="19"></tr>
</table>
</body>
</html>';
				mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader, "[email protected]") or die ("Failure"); 
				$fechaCalculo = date("Y-m-j" , time());
				list($año,$mes,$dia)=explode("-",$fechaCalculo);
				$nueva = mktime(0,0,0, $mes,$dia,$año) + 30 * 24 * 60 * 60;
				$nuevafecha=date("Y-m-j",$nueva);
				$nuevafecha .=" 00:00:00";
				$fechaCalculo .= " 00:00:00";

				$insertContacto = "INSERT INTO mensajes (idCliente, mensaje, nombreM, correoM, fechaM) VALUES (".$_POST['cliente'].", '".nl2br($_POST["comment"])."', '".$_POST["name"]."', '".$_POST["email"]."', '$fechaCalculo')";

				mysql_query($insertContacto, $conexion->getLink());

			?> 
			Mensaje Envido.

			<?php
			}
			else
			echo "Cliente no encontrado";
			} else { 
			?> 
                
                
                <form action="contactar.php" method="post">
                	<input type="hidden" name="cliente" id="cliente" value="<?php echo $_GET['idCliente'];?>" />
    				<input type="hidden" name="propiedad" id="propiedad" value="<?php echo $_GET['idPropiedad'];?>" />
                	Nombre:
                    <input type="text" name="name" class="cajasTexto" style="width:250px; margin-right:20px; margin-left:0px" value="" /><br />
                    Email:
                    <span id="sprytextfield1">
                     		<input type="text" name="email" class="cajasTexto" style="width:250px; margin-right:20px" />
                     	</span>
                    <br />
                    Texto:
                     <textarea id="comment" name="comment" style="width:250px; height:100px; vertical-align:top; margin-right:20px" class="cajasTexto" > </textarea>
                    <br />
                <input type="image" name="enviar" src="imagenes/enviarAmigo/boton-enviar.png" align="right"  style="margin-right:100px; margin-bottom:10px"/>
                </form>	
                
                <script type="text/javascript">
				var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "email", {validateOn:["blur"]});
			</script>

                <?php 
				}; 
				?>
               
                <br />
          </div>
	</div>
</body>

</html>

 

thx

 

 

Link to comment
https://forums.phpfreaks.com/topic/210375-email-function-probs/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.