Jump to content

accented characters in mail


digitalecartoons

Recommended Posts

I've made a flash form which uses this script to send the input by mail:

<?php
// initialize variables for To and Subject fields
$to = 'info@testing.nl';
$subject = 'Een testmail';
$from = $_POST["from"];
$email = $_POST["email"];
$comments = $_POST["comments"];

// build message body from variables received in the POST array
$message = "Van: $from \n\n";
$message .= "Email: $email \n\n";
$message .= "Bericht: $comments";
$message = stripslashes($message);

//convert flash line breaks
$message= str_replace("\r", "\n", $message);
$message=nl2br($message);

// add additional email headers for more user-friendly reply
$additionalHeaders  = "From: $from <".$email.">\r\n";
$additionalHeaders .= "Reply-To: ".$email."\r\n";
$additionalHeaders .= "MIME-Version: 1.0\r\n";
$additionalHeaders .= "Content-type: text/html; charset=utf-8\r\n";


// send email message
$OK = mail($to, $subject, $message, $additionalHeaders);
// let Flash know what the result was
if ($OK) {
  echo 'sent=OK';
  }
  else {
  echo 'sent=failed&reason='. urlencode('Er is een probleem met de server. Probeer het later nog eens.');
  }
?>

 

Works a bit besides accented characters like é ë ä ó ö ú etc. For example: when I use 'René' in the From field it arrives like 'RenX', but in text mode as in html mode. The From fiels displays 'RenX' I mean.

 

When in text mode, the body text of the email displays 'René' however.

 

When I view the mail in html mode, it also displays 'RenX' in the From field, but the body text displays 'rené'.

 

How to I make it display René both in the From field and the body text? And both in text mode as in html mode?

Link to comment
Share on other sites

I would suggest that you use an email client that you know works and send yourself a message with the correct information in it.

 

Then when it gets to you, have a look at the message source and find out how it is done. Probably setting character encoding in a different place or something like that?

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.