Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Mail: special characters show different between Firefox and IE
    primarykey
    data
    text
    <p>I have a problem when sending a form via email using the PHP Mail function. This is the code that I'm using:</p> <pre><code>$name = $_POST['name']; $last_name = $_POST['last_name']; $company = $_POST['company']; $email = $_POST['email']; $country = $_POST['country']; $phone = $_POST['phone']; $message = $_POST['message']); //This comes from the form $formcontent="Name: $name $last_name &lt;br&gt; Company: $company &lt;br&gt; Email: $email &lt;br&gt; Country: $country &lt;br&gt; Telephone: $phone &lt;br&gt;&lt;br&gt; Message: $message"; $mailheader = 'MIME-Version: 1.0' . "\r\n"; $mailheader .= 'Content-type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable' . "\r\n"; $mailheader .= 'From: ' . $email . "\r\n"; mail("my@email.com", "subject", $formcontent, $mailheader) or die("Error!"); </code></pre> <p>This is a form that will be sending spanish and special characters, like ñ, accents, ç, etc...</p> <p>The problem is that, if I use it like this, it works fine in Firefox 3.6.3, but when using the form in Internet Explorer 8, the special characters that sends are all messed up (like ç instead of a ç). However, if I add <strong>utf8_encode</strong> to the variables in the <strong>$formcontent</strong>, then it works in IE, but it stops working in Firefox, showing stuff like η instead of ç.</p> <p>What can I do to make it work regardless of the browser? Any help would be much appreciated!</p> <p><strong>EDIT:</strong></p> <p>I've noticed that, if I echo the <strong>$formcontent</strong> variable before sending it with <strong>mail</strong>, if I'm using Firefox, the special characters are already messed-up. How can I avoid the browsers interfering with what's being sent? Please I'm totally clueless right now!!! I don't know what to change to have something working. Even if it's a dumbed down version, is there any alternative to have PHP Mail working with special characters in both browsers?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload