Foros del Web » Programando para Internet » PHP »

Enviar correo desde web

Estas en el tema de Enviar correo desde web en el foro de PHP en Foros del Web. Buenas noches, Queria saber si alguien tiene algun codigo en php donde escriba el nombre de la persona escriba el sujeto y mi email este ...
  #1 (permalink)  
Antiguo 19/10/2008, 19:55
 
Fecha de Ingreso: septiembre-2004
Ubicación: Maracay Edo. Aragua
Mensajes: 45
Antigüedad: 19 años, 7 meses
Puntos: 0
Exclamación Enviar correo desde web

Buenas noches,

Queria saber si alguien tiene algun codigo en php donde escriba el nombre de la persona escriba el sujeto y mi email este ya predefinido y tenga una parta para escribir mensaje y cuando oprima enviar le envie el mensaje al correo pero que permita enviar en forma de html

algo como este anonymailo pero en mi caso lo que quiero es enviar mensajes desde mi web de forma rapida a un correo. (OJO EL SCRIPT SOLO ES UN EJEMPLO SI DE HAY PUEDEN AYUDARME LO AGRADESCO YA QUE EL SCRIPT AL TRATAR DE ENVIARLO LLEGA EL NOMBRE PERO DESDE EL SUGETO HASTA LA PARTE DE ESCRIBIR NO LLEGA NADA)
Código PHP:
<?php

// Rename this file to anonymail.php
// Upload it to your site and point links to it
// Enter your company name, site URL, and optional banner information below 

$sitename "Prizeparadise Business Exchange"
$siteaddress ="http://prizeparadise.com"
$bannerlink ="http://autohits.dk/?ref=1099463106";
$bannerpic "http://autohits.dk/banner/autohits_banner_468x60_04.gif";

// To Log emails sent, create a Text File in the same Directory called url-log.txt 
// CHMOD the file to allow Write permissions only (555)
// If you don't want to log your emails, remove the 4 lines of code indicated later in the script

if (!isset($_POST['submit_form'])):
$ip getenv("REMOTE_ADDR");
?>
<html>
<head>


</script>

<title>prueba</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
<body bgcolor="#000080" text="#FFFFFF">
<h1><center>
</center></h1>
<p>
<form action="<?=$HTTP_SERVER_VARS['../PHP_SELF']?>" method="post">
Nombre de la Persona:
   <input type="text" name="rname" size="35" value=""><br>
E-mail de la Persona:
 <input type="text" name="remail" size="35" value=""><br>
Tu nombre:
 <input type="text" name="fname" size="35" value=""><br>
Tu email:              
 
<input type="text" name="femail" size="35" value="">
     <p>
Sujeto:
  <input type="text" name="subject" size="55" value="">
 <p>
<b>tu mensaje :</b><br>
Esto sirve para enviar correos en formato html, no funciona para enviar java ni php<br>
<textarea name="body" cols="75" rows="12" size="800" WRAP></textarea><br><br>

<br>
<input type="button" value="ver html" onClick="displayHTML(this.form)">
<input type="submit" name="submit_form" value="Enviar">
<p><p>
</form>
</body>
</html>
<?php else:

$rname $_POST['rname'];
$remail $_POST['remail'];
$fname $_POST['fname'];
$femail $_POST['femail'];
$tag $_POST['tag'];
$qc $_POST['qc'];
$body stripslashes("$body");
$subject stripslashes("$subject");

if ((
$rname=="") || ($fname=="")  || ($femail=="")|| ($remail==""))  {
print 
"Please use your back button and complete all of the required form fields, then resubmit.<br><br><br><br><br><br><br><br><br><br><br>";
die;}
else {}
// Send your html email
$to $remail;
$subject "$subject";
$message "
<html>
<head>
<title></title>

</head>
<body>
<font style=\"font-family:tahoma, arial, verdana;font-size:10pt\"><pre>
$body
<p><p></pre>
<a href=\"$siteaddress\">$tag</a>
</font>
</body>
</html>
"
;

// IF YOU CHANGE THE LINK ABOVE, IT MUST CONTAIN THE \ BEFORE EACH " MARK.
// Some mail servers require a \r added before the \n in the next header lines.

$headers  "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .="From:$fname <$femail>\n";

mail($to$subject$message$headers);
// Done sending autoresponder

// If you do not want to log your emails, remove the next 4 lines of code

$filename="url-log.txt";
$fl=fopen($filename,"a+");
fwrite($fl,"From: $fname   From email: $femail   IP: $ip\nTo: $rname   To email: $remail\n\n$body\n\n$tag \n-------------------------------------------------------------------\n");
fclose($fl);

?>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
<font style="font-family:tahoma, arial, verdana;font-size:14pt"><body bgcolor="#000080" text="#FFFFFF">
Querido <?=$fname?> ya lo lograstes,
<p>tu email fue enviado con exito.
<p>si quieres enviar otro solo oprime regresar.</p>
</font>

</body>
</html>
<?php endif; ?>
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 14:53.