hola a todos ojala alguien pueda ayudarme, la verdad es que no se nada de php, pero al menos intento aprender y leer todo lo que puedo (lei las faqs pero no encontre respuesta :( , se me presenta el siguiente problema: en una pag tipica de formularios esas tipicas de "contactanos" donde el visitante pone su nombre su mail su asunto su mensaje, etc etc llega a mi e-mail, todo eso marcha bien el problema es que solo el campo "mensaje" del formulario llega en el cuerpo del mail, los otros datos llegan en forma de encabezados mime (mime headers) y para leerlos hay que ver el codigo del mail :(, lo cual comprenderan es poco eficiente cuando si se recibe un alto numero de mail al dia, aca les envio el codigo con la esperanza que alguien puda ayudar en mi dilema :)
(ojo: el codigo que pego a continuacion no es de mi autoria) :)
____________________________________
Código PHP:
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._CONTACTUS."";
$index = 1;
function ns_info() {
global $module_name, $sitename, $prefix, $dbi;
$result = sql_query("select address from ".$prefix."_ns_contact_add", $dbi);
list($address) = sql_fetch_array($result, $dbi);
$address = FixQuotes(nl2br($address));
echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" align=\"center\">";
echo "<tr><td align=\"left\">";
echo "$address";
echo "</td></tr></table><br>";
}
function ns_phone() {
global $module_name, $sitename, $prefix, $dbi;
echo "<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" align=\"center\">";
$result = sql_query("select pid, phone_name, phone_num from ".$prefix."_ns_contact_phone order by phone_name", $dbi);
while(list($pid, $phone_name, $phone_num) = sql_fetch_array($result, $dbi)) {
echo "<tr><td align=\"right\">";
echo "<font class=\"content\">$phone_name:</td>";
echo "<td align=\"left\">$phone_num</td></tr>";
}
echo "</table><br><br>";
}
function ns_form() {
global $module_name, $sitename, $prefix, $dbi;
include("header.php");
OpenTable();
echo "<center><font class=\"title\">"._CONTACTUS."</font></center>";
CloseTable();
OpenTable();
$result_s = sql_query("select show_add from ".$prefix."_ns_contact_show", $dbi);
list($show_add) = sql_fetch_array($result_s, $dbi);
if ($show_add == 1) {
echo "<br><br><center><font class=\"title\"><u>"._ADDRESSINFO."</u></font></center><br>";
ns_info();
echo "<hr>";
}
$result_p = sql_query("SELECT * FROM ".$prefix."_ns_contact_phone", $dbi);
$num = sql_num_rows($result_p, $dbi);
if ($num > 0) {
echo "<br><br><center><font class=\"title\"><u>"._PHONEINFO."</u></font></center><br>";
ns_phone();
echo "<hr>";
}
echo "<br><center><font class=\"title\">"._FORMHEADER." $sitename</font></center><br><br>";
if (is_user($user)) {
$result_ui = sql_query("select name, uname, email from ".$user_prefix."_users where uname='$cookie[1]'", $dbi);
list($yn, $yun, $ye) = sql_fetch_row($result_ui, $dbi);}
if ($yn != "") { $ns_un = $yn; } else { $ns_un = $yun; }
echo "<form action=\"modules.php?name=$module_name\" method=\"post\"";
echo "name=\"contact_plus\">";
echo "<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" align=\"center\">";
echo "<tr><td align=\"left\" valign=\"middle\"><font class=\"content\"><b>"._YOURNAME.":</b></font> ";
echo "<font class=\"tiny\">("._OPTIONAL.")</font><br>";
echo "<input name=\"cname\" size=\"35\" value=\"$ns_un\"></td></tr>";
echo "<tr><td align=\"left\" valign=\"middle\">";
echo "<font class=\"content\"><b>"._YOUREMAIL.":</b></font><br>";
echo "<input name=\"from\" size=\"35\" value=\"$ye\"></td></tr>";
echo "<tr><td align=\"left\" valign=\"middle\">";
echo "<font class=\"content\"><b>"._PLEASESELECT.":</b></font><br>";
echo "<select name=\"dpid\">";
echo "<option value=\"\" selected>---------------------------------";
echo "<option value=\"\">";
$result = $db->sql_query("select did, dept_name, dept_email from ".$prefix."_ns_contact_dept order by dept_name");
while ($row = $db->sql_fetchrow($result)) {
$did = $row[did];
$dept_name = $row[dept_name];
$dept_email = $row[dept_email];
echo "<option value=\"$did\">$dept_name";
}
echo "<option value=\"\">";
echo "</select></td></tr>";
echo "<tr><td align=\"left\" valign=\"middle\">";
echo "<font class=\"content\"><b>"._YOURMESSAGE.":</b></font><br>";
echo "<textarea cols=\"55\" name=\"message\" rows=\"12\" ></textarea></td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\" valign=\"middle\">";
echo "<input type=\"hidden\" name=\"op\" value=\"ns_send\">";
echo "<input type=\"submit\" name=\"submit\" value=\""._SEND."\">";
echo " <input type=\"reset\" value=\""._CLEAR."\">";
echo "</td></tr></table></form>";
echo "<br>";
Closetable();
include("footer.php");
}
function ns_send($dpid, $cname, $from, $email, $message) {
global $module_name, $sitename, $prefix, $dbi;
include("header.php");
if(ereg("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$",$from)) {
} else {
OpenTable();
echo "<center><font class=\"title\">"._CONTACTUS."</font></center>";
CloseTable();
OpenTable();
echo"<br><center><font class=\"title\">"._INVALIDEMAIL.":<br><br>";
echo"<font color=\"#CC0000\">$from</font><br><br>"._INVALIDEMAIL2."</font>";
echo"<br><br><br><font class=\"title\">"._PLEASEGO."</font>";
echo"<br><br>";
echo"[ <a href=\"javascript:history.go(-1)\">"._BACK."</a> ]</center><br>";
CloseTable();
include ("footer.php");
exit;
}
if ($dpid == "") {
OpenTable();
echo "<center><font class=\"title\">"._CONTACTUS."</font></center>";
CloseTable();
OpenTable();
echo"<br><center><font class=\"title\">"._SELECTDEPARTMENT."<br><br>";
echo""._PLEASEGO3."</font>";
echo"<br><br>";
echo"[ <a href=\"javascript:history.go(-1)\">"._BACK."</a> ]</center><br>";
CloseTable();
include ("footer.php");
exit;
}
if ($message == "") {
OpenTable();
echo "<center><font class=\"title\">"._CONTACTUS."</font></center>";
CloseTable();
OpenTable();
echo"<br><center><font class=\"title\">"._NOMESSAGE."<br><br>";
echo""._PLEASEGO2."</font>";
echo"<br><br>";
echo"[ <a href=\"javascript:history.go(-1)\">"._BACK."</a> ]</center><br>";
CloseTable();
include ("footer.php");
exit;
}
$result = sql_query("select dept_name, dept_email from ".$prefix."_ns_contact_dept where did='$dpid'", $dbi);
list($dept_name, $dept_email)=sql_fetch_row($result, $dbi);
$department = $dept_name;
$department = stripslashes(trim($department));
$subject = $department;
$from = strip_tags(trim($from));
$message = stripslashes(trim($message));
$header = ""._FROM.": "._CONTACTFORM." - $cname <$from>\r\n";
$header .= "\n";
$header .= ""._VISITOR.": $cname <$from>\r\n\n";
$header .= ""._TODEPARTMENT.": $department\r\n\n";
$header .= ""._MESSAGE.":\r\n";
$header .= "\n==============================================================";
@$send=mail($dept_email,$subject,$message,$header);
if ($send == 1) {
OpenTable();
echo "<center><font class=\"title\">"._CONTACTUS."</font></center>";
CloseTable();
OpenTable();
echo "<br>";
echo "<br><div align=\"center\"><font class=\"title\">"._THANKYOUFOR." $sitename</font>";
echo "<br><br>"._EMAILSENT."<br>"._GETBACK."</div><br><br>";
echo "<center>[ <a href=\"index.php\">"._HOME."</a> ] - ";
echo "[ <a href=\"modules.php?name=$module_name\">"._CONTACTFORM."</a> ]</center><br>";
echo "<br>";
CloseTable();
include ("footer.php");
} else {
OpenTable();
echo "<center><font class=\"title\">"._CONTACTUS."</font></center>";
CloseTable();
OpenTable();
echo"<center><font class=\"title\">"._ERROR2."</font>";
echo"<br>"._TRYAGAIN."<br>";
echo"[ <a href=\"modules.php?name=Contact\">"._BACK."</a> ]</center>";
CloseTable();
include ("footer.php");
}
exit();
include("footer.php");
}
switch ($op) {
case "ns_send":
ns_send($dpid, $cname, $from, $email, $message);
break;
default:
ns_form();
break;
}
___________________________________________
desde ya me despido agradecido por la ayuda