Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-18-2011, 02:11 AM email characters
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Hi there
I made a php file in order to sent a message from a my page website form.
Despite the fact that I transformed the file from ANSI to UTF-8 unicode, when a send a message with text in Portuguese or French, or any other characters does not appear correctly: é ão ção
The fixed words it appears ok due the fact I used the special codes like “á” and so on for the characters, but whatever the end user rights the funny characters appears.
What is the solution?
I’m send you here the script.
Thanks a lot
PHP Code:
<?
session_start
();
if( 
$_SESSION['security_code'] == $_POST['sec'] && !empty($_SESSION['security_code'] ) ) {
$adminaddress "e@wmail.pt";
$siteaddress ="www.website.pt"
$sitename "Company- PORTUGAL"
$date date("m/d/Y H:i:s");
$de" \"Company- PORTUGAL\" <e@mail.pt>";
if (
$_SERVER['REMOTE_ADDR'] == ""){ $ip "no ip"; } else { $ip $_SERVER['REMOTE_ADDR']; }
$email $_POST['email'] ;
$telefone$_POST['telefone'];
$name $_POST['nome'] ;
$company $_POST['company'];
$comments $_POST['comments'] ;
$assunto1="Mensagem de Visitante";
$assunto2="Obrigado por visitar $siteaddress";
if(!
$email){  header("location: contact.php?resposta=Todos os campos devem ser preenchidos. Email deve ser v&aacute;lido"); die(); }
$message="<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
</head>
<body>
<table width='700' border='0' align='center' bgcolor='#e0e0e0' cellpadding='0' cellspacing='0'>
  <tr>
    <td align='right' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff3300' size='5'><b>WEB</b></font><font face='arial' color='#ff0066' size='5'><b>SITE</b></font>
</td>
    <td width='67' align='left' valign='top' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>®</b></font></td>
    <td width='67' align='left' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>PORTUGAL</b></font></td>
    <td colspan='3' align='left' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='2'><b>&nbsp;&nbsp;Games</b></font></td>
  </tr>
   <tr>
    <td colspan='6' align='center'>&nbsp;</td>
  </tr>
   <tr>
    <td width='147' align='center' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'><b>Endere&ccedil;o:</b></font></td>
     <td colspan='3' align='center' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'><b>
$adminaddress</b></font></td>
      <td width='16' align='center'>&nbsp;</td>
     <td align='center' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'><b>Solicita&ccedil;&atilde;o de Informa&ccedil;&atilde;o</b></font></td>
     </tr>
   <tr>
    <td colspan='6' align='center'>&nbsp;</td>
  </tr>
  <tr>
    <td colspan='6' align='center'><font face='arial' color='#000000' size='3'><b>Um visitante deixou a seguinte Informa&ccedil;&atilde;o\n</b></font></td>
     </tr>
  <tr>
    <td colspan='6' align='center'>&nbsp; </td>
  </tr>
   <tr>
    <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Nome:</font></td>
     <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'>&nbsp;
$nome</font></td>
     <td align='center'>&nbsp; </td>
     <td align='center' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Coment&aacute;rio:</font></td>
     </tr>
   <tr>
    <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Email</font></td>
     <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'>&nbsp;
$email;</font></td>
     <td align='center'>&nbsp; </td>
     <td rowspan='5' align='justify' valign='top' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>
$comments</font></td>
     </tr>
  <tr>
    <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'>Telefone:</font></td>
     <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'>&nbsp;
$telefone</font></td>
     <td align='center'>&nbsp; </td>
     </tr>
   <tr>
    <td align='right' bgcolor='#c6c6c6'><font face='arial' color='#000000' size='3'></font><font face  'arial' color='#000000' size='3'>Empresa:</font></td>
     <td colspan='3' align='left' bgcolor='#c6c6c6'><font face='arial' color='#009933' size='3'>&nbsp;
$company\n</font></td>
     <td align='center'>&nbsp; </td>
     </tr>
    <td colspan='5'>&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>
</body>
</html>"
;
$message2="<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
</head>
<body><table width='700' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#e0e0e0'>
  <tr>
    <td width='232' align='right' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff3300' size='5'><b>WEB</b></font><font face='arial' color='#ff0066' size='5'><b>SITE</b></font></td>
    <td width='35' align='left' valign='top' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>®</b></font></td>
    <td width='419' colspan='3' align='left' valign='bottom' bgcolor='#c6c6c6'><font face='arial' color='#ff0066' size='2'><b>PORTUGAL</b></font>&nbsp;&nbsp;<font face='arial' color='#000000' size='2'><b>Games</b></font></td>
  </tr>
   <tr>
    <td colspan='5' align='center'  bgcolor='#33FF66'><font face='arial' color='#000000' size='3'>&nbsp;</font></td>
  </tr>
  <tr>
    <td colspan='5' align='center'>&nbsp; </td>
  </tr>
  <tr>
    <td colspan='5' align='center' bgcolor='#c6c6c6'><table width='680' border='0' cellspacing='0' cellpadding='0'>
      <tr>
        <td colspan='2' align= right>Usando:&nbsp;</td>
        <td width='10'>&nbsp;</td>
        <td width='374'>&nbsp;
$HTTP_USER_AGENT</td>
      </tr>
      <tr>
        <td colspan='2' align='right'>Hostname:&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;
$ip</td>
      </tr>
      <tr>
        <td colspan='2'  align='right'>Endere&ccedil;o:&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;
$REMOTE_ADDR</td>
      </tr>
      <tr>
        <td colspan='2' align='right'>Data/Hora:&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;
$date</td>
      </tr>
      <tr>
        <td colspan='2' align='right'>De:&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;
$adminaddress</td>
      </tr>
    <tr>
        <td colspan='2' align='right'>Email</td>
        <td>&nbsp;</td>
        <td>&nbsp;
$email</td>
      </tr>
      <tr>
        <td colspan='4'>&nbsp;</td>
      </tr>
      <tr>
        <td align='right'>&nbsp;Exmo(a)</td>
        <td colspan='3' align='left'>&nbsp;
$name</td>
      </tr>
      <tr>
        <td align='right'>&nbsp;</td>
        <td colspan='3' align='left'>&nbsp;</td>
      </tr>
      <tr>
        <td width='161' align='right'>&nbsp;</td>
        <td colspan='3' align='left'>&nbsp;Obrigados pela sua visita</td>
      </tr>
      <tr>
        <td align='right'>&nbsp;</td>
        <td colspan='3' align='left'>&nbsp;Entraremos brevemente em contacto consigo.</td>
      </tr>
      <tr>
        <td align='right'>&nbsp;</td>
        <td colspan='3' align='left'>&nbsp;</td>
      </tr>
      <tr>
        <td align='right'>&nbsp;</td>
        <td colspan='3' align='left'>&nbsp;Cumprimentos</td>
      </tr>
      <tr>
        <td align='right'>&nbsp;</td>
        <td colspan='3' align='left'>&nbsp;</td>
      </tr>
      <tr>
        <td align='right'>&nbsp;</td>
        <td colspan='3' align='left'><a href=\"
$siteaddress\" target=\"_blank\">$de</a></td>
      </tr>
        <td colspan='4'>&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table></body></html>"
;
mail ($adminaddress$assunto1$message"From:".$de."\nContent-Type: text/html;\n");
mail ($email$assunto2$message2"From:".$de."\nContent-Type: text/html;\n");
 
header("location: contact.php?resposta=Contacto enviado com sucesso.<br>Obrigados<br>Ir&acute receber confirma&ccedil;&atilde;o dentro de momentos...");
 die();
} else {
header("location: contact.php?resposta=Código inv&aacute;lido, por favor tente novamente!");
die();
}
?>
josil is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-18-2011, 02:43 AM Re: email characters
Junior Talker

Posts: 2
Name: No
Trades: 0
This is most likely not the code, its the way your browser is interpreting the characters.
crimsonlung is offline
Reply With Quote
View Public Profile
 
Old 02-18-2011, 03:29 AM Re: email characters
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by crimsonlung View Post
This is most likely not the code, its the way your browser is interpreting the characters.
Probably, but I have other scripts laike the translations, and menus that shows ok.

here it is only the words that the user uses when send the message
josil is offline
Reply With Quote
View Public Profile
 
Old 02-18-2011, 04:39 AM Re: email characters
Skilled Talker

Posts: 60
Name: Dmitry
Trades: 0
Try to change this
Quote:
"\nContent-Type: text/html;\n"
to
Quote:
"\nContent-Type: text/html;charset=utf-8\r\n"
Or something like that
__________________
Sincerely, Dmitry

Please login or register to view this content. Registration is FREE
ElmanF is offline
Reply With Quote
View Public Profile Visit ElmanF's homepage!
 
Old 02-18-2011, 07:13 AM Re: email characters
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Quote:
Originally Posted by ElmanF View Post
Try to change this

to

Or something like that

My friend thanks a million. It works fantastic.

You're a star..


thanks
josil is offline
Reply With Quote
View Public Profile
 
Old 02-18-2011, 08:16 AM Still Email Characters
Super Talker

Posts: 128
Name: Jose daSilva
Trades: 0
Hi again

In another script at the beginning I have this:
PHP Code:
 
$subject 
"".$lab_wassolicited.$sitename - ID: $reference";
$subject2 "".$lab_wassolicited1.":$reference ".$lab_in.$sitename ".$lab_wassent.".";
$de" \" $costumername\" <$costumermail>";
$from" \" WEBSITE  $country\" <$emailvend>"
when the mail is received, the subject, and the names (sender and receiver) if they have latin characters, appears like é í.

Can be helped here?

Thanks
josil is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to email characters
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23668 seconds with 12 queries