Funcion mail() y acentos y eñes

Iniciado por evilforces, 6 Agosto 2007, 16:58 PM

0 Miembros y 1 Visitante están viendo este tema.

evilforces

Hola a tod@s!!! Resulta que tengo una pagina montada con php y el unico problema que tengo es que cuando la gente utiliza el formulario de contacto me llega el correo perfectamente pero no me pone las ñ ni los acentos (asi como caracteres especiales como arrobas, etc...)

He buscado mucho por internet y se que es un problema de la funcion mail, pero no se como solucionarlo. Os dejo el codigo del formulario a ver si me podeis hechar una mano. Gracias de antemano.

if (!defined('MODULE_FILE')) {
die ("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

/**********************************/
/* Configuration                  */
/*                                */
/* You can change this:           */
/* $index = 0; (right side off)   */
/**********************************/
$index = 1;
$subject = "$sitename "._FEEDBACK."";
/**********************************/

include("header.php");
$cookie[0] = intval($cookie[0]);
if ($cookie[1] != "") {
$row = $db->sql_fetchrow($db->sql_query("SELECT name, username, user_email FROM ".$user_prefix."_users WHERE user_id='$cookie[0]'"));
if ($row['name'] != "") {
$sender_name = $row['name'];
} else {
$sender_name = $row['username'];
}
$sender_email = $row['user_email'];
}

$form_block = "
    <center><font class=\"title\"><b>XATICAP - Asociación Xàtiva Carreras Populares</b></font>
    <br><br><font class=\"content\">"._FEEDBACKNOTE."</font>
    <FORM METHOD=\"post\" ACTION=\"modules.php?name=$module_name\">
    <P><strong>"._YOURNAME.":</strong><br>
    <INPUT type=\"text\" NAME=\"sender_name\" VALUE=\"$sender_name\" SIZE=30></p>
    <P><strong>"._YOUREMAIL.":</strong><br>
    <INPUT type=\"text\" NAME=\"sender_email\" VALUE=\"$sender_email\" SIZE=30></p>
    <P><strong>"._MESSAGE.":</strong><br>
    <TEXTAREA NAME=\"message\" COLS=70 ROWS=15 WRAP=virtual>$message</TEXTAREA></p>
    <INPUT type=\"hidden\" name=\"opi\" value=\"ds\">
    <P><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\""._SEND."\"></p>
    </FORM></center>
";

OpenTable();
if ($opi != "ds") {
echo "$form_block";
} elseif ($opi == "ds") {
if ($sender_name == "") {
$name_err = "<center><font class=\"option\"><b><i>"._FBENTERNAME."</i></b></font></center><br>";
$send = "no";
}
if ($sender_email == "") {
$email_err = "<center><font class=\"option\"><b><i>"._FBENTEREMAIL."</i></b></font></center><br>";
$send = "no";
}
if ($message == "") {
$message_err = "<center><font class=\"option\"><b><i>"._FBENTERMESSAGE."</i></b></font></center><br>";
$send = "no";
}

if ($send != "no") {

$sender_name = $sender_name;
$sender_email = $sender_email;
$msg = "mipaginaweb.com\n\n";
$msg .= ""._SENDERNAME.": $sender_name\n";
$msg .= ""._SENDEREMAIL.": $sender_email\n";
$msg .= ""._MESSAGE.": $message\n\n";
$to = $adminmail;
$mailheaders = "From: $sender_name <$sender_email>\n";
$mailheaders .= "Reply-To: $sender_email\n\n";

mail($to, $subject, $msg, $mailheaders);
echo "<P><center>"._FBMAILSENT."</center></p>";
echo "<P><center>"._FBTHANKSFORCONTACT."</center></p>";
}




elseif ($send == "no") {
OpenTable2();
echo "$name_err";
echo "$email_err";
echo "$message_err";
CloseTable2();
echo "<br><br>";
echo "$form_block";
}
}

CloseTable();
include("footer.php");

?>

yeikos

Código (php) [Seleccionar]
<?php
if (!defined('MODULE_FILE')) {
die ("You can't access this file directly...");
}

require_once(
"mainfile.php");
$module_name basename(dirname(__FILE__));
get_lang($module_name);

/**********************************/
/* Configuration                  */
/*                                */
/* You can change this:           */
/* $index = 0; (right side off)   */
/**********************************/
$index 1;
$subject "$sitename "._FEEDBACK."";
/**********************************/

include("header.php");
$cookie[0] = intval($cookie[0]);
if (
$cookie[1] != "") {
$row $db->sql_fetchrow($db->sql_query("SELECT name, username, user_email FROM ".$user_prefix."_users WHERE user_id='$cookie[0]'"));
if ($row['name'] != "") {
$sender_name $row['name'];
} else {
$sender_name $row['username'];
}
$sender_email $row['user_email'];
}

$form_block "
    <center><font class=\"title\"><b>XATICAP - Asociación Xàtiva Carreras Populares</b></font>
    <br><br><font class=\"content\">"
._FEEDBACKNOTE."</font>
    <FORM METHOD=\"post\" ACTION=\"modules.php?name=
$module_name\">
    <P><strong>"
._YOURNAME.":</strong><br>
    <INPUT type=\"text\" NAME=\"sender_name\" VALUE=\"
$sender_name\" SIZE=30></p>
    <P><strong>"
._YOUREMAIL.":</strong><br>
    <INPUT type=\"text\" NAME=\"sender_email\" VALUE=\"
$sender_email\" SIZE=30></p>
    <P><strong>"
._MESSAGE.":</strong><br>
    <TEXTAREA NAME=\"message\" COLS=70 ROWS=15 WRAP=virtual>
$message</TEXTAREA></p>
    <INPUT type=\"hidden\" name=\"opi\" value=\"ds\">
    <P><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\""
._SEND."\"></p>
    </FORM></center>
"
;

OpenTable();
if (
$opi != "ds") {
echo "$form_block";
} elseif (
$opi == "ds") {
if ($sender_name == "") {
$name_err "<center><font class=\"option\"><b><i>"._FBENTERNAME."</i></b></font></center><br>";
$send "no";
}
if ($sender_email == "") {
$email_err "<center><font class=\"option\"><b><i>"._FBENTEREMAIL."</i></b></font></center><br>";
$send "no";
}
if ($message == "") {
$message_err "<center><font class=\"option\"><b><i>"._FBENTERMESSAGE."</i></b></font></center><br>";
$send "no";
}

if ($send != "no") {

  $sender_name $sender_name;
$sender_email $sender_email;
$msg "mipaginaweb.com\n\n";
$msg .= ""._SENDERNAME.": $sender_name\n";
$msg .= ""._SENDEREMAIL.": $sender_email\n";
$msg .= ""._MESSAGE.": $message\n\n";
$to $adminmail;
$mailheaders "From: $sender_name <$sender_email>\n";
$mailheaders .= "Reply-To: $sender_email\n";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1 \r\n\n";
mail($to$subjectutf8_decode($msg), $mailheaders); 
echo "<P><center>"._FBMAILSENT."</center></p>";
echo "<P><center>"._FBTHANKSFORCONTACT."</center></p>";





elseif ($send == "no") {
OpenTable2();
echo "$name_err";
echo "$email_err";
echo "$message_err";
CloseTable2();
echo "<br><br>";
echo "$form_block";
}
}

CloseTable();
include(
"footer.php");

?>