Jump to content

Recommended Posts

I have a html order form which when submitted goes to a php page which sends the order to an email address in html formal rather than plain txt

 

the headers i use to do this is:

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";

 

But

 

When the email comes through i get a funny charactor in front of a pound sign: £20.00

 

Any one got any ideas why?

 

Thanks

ldoozer

 

 

This sounds like it could be because of some encoding problems. Is both the form page in UTF-8 and is the mail client reading the email as UTF-8? Also, make sure that the browser and mail client IS really using the character encoding. (because sometimes the clients may ignore character encoding)

 

The reason it's displayed like that, is because the UTF-8 code in hex for pound sign is 0xC2 0xA3, which in Latin-1 charset translates into "£".

Use this it works always....

 

 

$to = 'bob@barnyard.com';
$subject = 'Wakeup bob!';
$message = '<b>yo</b>, whassup?';
$headers = "From: server@barnyard.com\r\n" .
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: 8bit\r\n\r\n";

// Send
mail($to, $subject, $message, $headers);

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.