Jump to content

mail form - wrong characters


usernature

Recommended Posts

hello.

 

Ive a customized simple mail script that uses the mail function to send and e-mail from a webpage form.

Ive created it using this one: http://www.codetricks.com/article.php?cat=&id=11

 

 

The problem: When I see the sent email in the Microsoft Outlook , the special characters are not displayed correctly.

for example the "ç" are displayed as "ç". When i see the sent email directly in gmail everithing works fine.

 

Can anyone help-me?

 

Thanks

fred

Link to comment
Share on other sites

hello tippy!

 

where do i write that ? "Content-Type: text/html; charset=UNICODE-1-1-UTF-8"

 

here's my script:

 

 

<?php

/*Declaração de variaveis*/

$nome = $_POST['nome'];

$empresa = $_POST['empresa'];

$email = $_POST['email'];

$mensagem = $_POST['mensagem'];

//Guardar o Nome e a mensagem numa variavel:

$formcontent=" enviado pos:$empresa, por:$nome\n\nMensagem: $mensagem";

$recipient = "test_mail_script@gmail.com";

$subject = "Pedido de Orcamento ou Informacoes";

$mailheader = "From: $email\r\n";

$mailheader .= "Reply-To: $email\r\n";

$mailheader .= "MIME-Version: 1.0\r\n";

 

 

//Verificar os campos obrigatórios:

 

if((!$nome) || (!$email)){

echo '<b>Não</b> prencheu os campos obrigatórios: <br><br>';

if(!$nome){

echo "  O Nome é um campo obrigatório. <a href=javascript:history.back()>volte atrás</a> e tente de novo. <br><br>";

}

if(!$email){

echo "O seu e-mail é um campo obrigatório. <a href=javascript:history.back()>volte atrás</a> e tente de novo. <br><br>";

}

 

exit();

}

 

 

 

//enviar a mensagem

mail($recipient, $subject, $formcontent, $mailheader) or die("Houve uma falha no envio da mensagem. Tente novamente e se não funcionar tente mais tarde. Pedimos desculpas pelo incomodo. <br><br>««<a href=javascript:history.back()>Tentar Novamente</a>");

echo ("A enviar! Redirecionando..."); // Texto que aparece quando está a enviar

echo "<meta http-equiv='refresh' content='1; url=http://teste.teste.suc.html'>"; // Redirecciona para uma páginas depois de enviado

;

?>

Link to comment
Share on other sites

HEllo again!

 

with "$mailheader .= "Content-Type: text/html; charset=UNICODE-1-1-UTF-8\r\n";" 

works fine now when i use Microsoft Outlook.

 

But now i still have a problem: When i read the message trough webmail (Horde Email Platform) the message is received as an html attachment

instead of a regular e-mail. I think this can be a Horde Email plaform restriction/problem because i didnt find any option to solve that question in the configuration options. But it doesnt make sense because when I read the message trough GMAIL everything is displayed correctly.

 

Do you have any idea of what can be the problem and what can i do to solve it?

 

 

Thanks

 

fred

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.