Jump to content

[SOLVED] strange charactor when sending mail


ldoozer

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 = '[email protected]';
$subject = 'Wakeup bob!';
$message = '<b>yo</b>, whassup?';
$headers = "From: [email protected]\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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.