Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/07/2011, 14:09
jose-web
 
Fecha de Ingreso: enero-2009
Ubicación: Tijuana
Mensajes: 80
Antigüedad: 15 años, 3 meses
Puntos: 2
Como acelerar envio de email en PHP

Hola amigos, tengo un problemita, mi cliente me exige que tiene que llegarle inmediatamente un correo desde la forma de su website, el sitio esta en godaddy.com entonces a que se debe la velocidad en que se envia un correo?

tiene algo que ver con PHP?

gracias.

este es mi formulario:

<?php
session_start();
if(isset($_POST["Code"])) {
if(($_SESSION['captcha_code'] == $_POST['Code']) && (!empty($_SESSION['captcha_code'])) ) {
//Passed!

$captcha_msg="Thank you";
$admin= '[email protected]';
$admin .="Bcc:[email protected]";
$subject= 'Cosmetic Surgery in Mexico - Spanish';
$message= 'Message to '.$admin.' from '.$email.":\n\n";

foreach($HTTP_POST_VARS as $name=> $value) {
$message.= "$name: $value\n";
}

$message = WORDWRAP($message,75,"\n");

mail($admin, $subject, STRIPSLASHES( $message ) , "From: $email");

header('Location: http://'.getenv('HTTP_HOST').'/gracias.php');

}else{
// Not passed 8-(
$captcha_msg="<font color=\"ff0000\">"."Codigo Invalido"."</font>";
//$captcha_msg="invalid code";
if(isset($_POST["MM_insert"])){
unset($_POST["MM_insert"]);
}
if(isset($_POST["MM_update"])){
unset($_POST["MM_update"]);
}
}
}
class CaptchaImage {
var $font = "verdana.ttf";
function hex_to_dec($hexcolor){
//convert hex hex values to decimal ones
$dec_color=array('r'=>hexdec(substr($hexcolor,0,2) ),'g'=>hexdec(substr($hexcolor,2,2)),'b'=>hexdec(s ubstr($hexcolor,4,2)));
return $dec_color;
}
function generateCode($characters) {
/* list all possible characters, similar looking characters and vowels have been removed */
$possible = '23456789bcdfghjkmnpqrstvwxyz';
$code = '';
$i = 0;
while ($i < $characters) {
$code .= substr($possible, mt_rand(0, strlen($possible)-1), 1);
$i++;
}
return $code;
}
function CaptchaImage($width='150',$height='30',$characters ='6',$hex_bg_color='FFFFFF',$hex_text_color="FF000 0",$hex_noise_color="CC0000", $img_file='captcha.jpg') {
$rgb_bg_color=$this->hex_to_dec($hex_bg_color);
$rgb_text_color=$this->hex_to_dec($hex_text_color);
$rgb_noise_color=$this->hex_to_dec($hex_noise_color);
$code = $this->generateCode($characters);
/* font size will be 60% of the image height */
$font_size = $height * 0.60;
$image = @imagecreate($width, $height) or die('Cannot Initialize new GD image stream');
/* set the colours */
$background_color = imagecolorallocate($image, $rgb_bg_color['r'], $rgb_bg_color['g'],$rgb_bg_color['b']);
$text_color = imagecolorallocate($image, $rgb_text_color['r'], $rgb_text_color['g'],$rgb_text_color['b']);
$noise_color = imagecolorallocate($image, $rgb_noise_color['r'], $rgb_noise_color['g'],$rgb_noise_color['b']);
/* generate random dots in background */
for( $i=0; $i<($width*$height)/3; $i++ ) {
imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
}
/* generate random lines in background */
for( $i=0; $i<($width*$height)/150; $i++ ) {
imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color);
}
/* create textbox and add text */
$textbox = imagettfbbox($font_size, 0, $this->font, $code);
$x = ($width - $textbox[4])/2;
$y = ($height - $textbox[5])/2;
imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code);
/* save the image */
imagejpeg($image,$img_file);
imagedestroy($image);
echo "<img src=\"$img_file?".time()."\" width=\"$width\" height=\"$height\" alt=\"security code\" id=\"captchaImg\">";
$_SESSION['captcha_code'] = $code;
}

}
?>

Formulario:

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text-panel">
<tr>
<td><form id="forma" name="forma" method="post" action="mismo.php" >
<table width="484" border="0" align="center" cellpadding="0" cellspacing="0" class="form" id="form">
<tr>
<td colspan="2"><p>
<label>* campo requerido<br />
<br />
</label>
</p></td>
</tr>
<tr>
<td width="220"><p>Nombre:</p></td>
<td width="170"><p>
<input name="contact_first_name" type="text" />
</p></td>
</tr>
<tr>
<td><p>Apellido:</p></td>
<td><p>
<input name="contact_last_name" type="text" />
</p></td>
</tr>
<tr>
<td><p>Direcci&oacute;n:</p></td>
<td><p>
<input name="contact_greeting" type="text" />
</p></td>
</tr>
<tr>
<td><p>
<label>Correo Electr&oacute;nico:</label>
<br />
<label></label>
</p></td>
<td><p>
<input name="email" type="text" id="email" size="25" maxlength="100" />
</p></td>
</tr>
<tr>
<td><p>Tel&eacute;fono:</p></td>
<td><p>
<input name="contact_home_phone" type="text" />
</p></td>
</tr>
<tr>
<td><p>&iquest;C&oacute;mo supo acerca de nosotros?</p></td>
<td><p>
<select name="how_did_you_hear_about_our_practice">
<option selected="selected">Seleccione Uno...</option>
<option value="Staff Member">Empleado </option>
<option value="Advertisement">Anuncio</option>
<option value="Yellow Pages">P&aacute;ginas Amarillas</option>
<option value="Other">Otro</option>
</select>
</p></td>
</tr>
<tr>
<td><p>&iquest;C&oacute;mo supo acerca de nuestra pagina de internet?</p></td>
<td><p>
<select name="how_did_you_find_our_website">
<option selected="selected">Seleccione uno...</option>
<option value="Search Engine">Search Engine</option>
<option value="Advertisement">Anuncio</option>
<option value="A friend">Un amigo</option>
<option value="Unknown">Desconocido</option>
</select>
</p></td>
</tr>
<tr>
<td><p>Comentarios:</p></td>
<td><p>
<textarea name="contact_comment" rows="7" cols="18"></textarea>
</p></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<p>* Por su seguridad, favor de poner el codigo de abajo:<br />
<?php $captcha = new CaptchaImage(150,50,5,'547d93','000000','0066CC'); ?>
<br />
Codigo
<input type="text" name="Code" id="Code" />
</p>
</div>
<p>
</label>
<?php echo $captcha_msg ?>&nbsp;&nbsp;</p></td>
</tr>
<tr>
<td><p>&nbsp;</p></td>
<td><p>
<input name="button2" type="submit" class="form" id="button2" value="Enviar" />
</p></td>
</tr>
</table>
</form></td>
</tr>
</table>

Gracias.