Canman2005 Posted February 2, 2009 Share Posted February 2, 2009 Hi all I'm sending out a plain text email in PHP and whenever a £ symbol is used, I get £ instead. I have had a look around online but cannot find any helpful solutions. Any ideas anyone? Thanks Dave Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/ Share on other sites More sharing options...
fanfavorite Posted February 2, 2009 Share Posted February 2, 2009 Those characters are the pound sign in utf-8 encoding. Check your settings. Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-752678 Share on other sites More sharing options...
fanfavorite Posted February 2, 2009 Share Posted February 2, 2009 A little more info: Should be in the headers like: $header_info = "MIME-Version: 1.0\r\n"; $header_info .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $header_info .= "From: Some Email Name <".$email.">"; Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-752681 Share on other sites More sharing options...
Canman2005 Posted February 2, 2009 Author Share Posted February 2, 2009 I think it's setup correct, I have $to = ''.$email.''; $subject = "Code"; $headers = "From: DES <[email protected]>\r\n"; $headers .= "Reply-To: [email protected]\r\n"; $headers .= "Return-Path: [email protected]\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/plain; charset=ISO-8859-1\r\n"; $message = '£10'; mail($to,$subject,$message,$headers); Any ideas? Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-752722 Share on other sites More sharing options...
Canman2005 Posted February 2, 2009 Author Share Posted February 2, 2009 Any ideas? Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-752869 Share on other sites More sharing options...
Canman2005 Posted February 3, 2009 Author Share Posted February 3, 2009 Still stuck on this and cannot seem to resolve it, has it got to do with the charset im sending? Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-753422 Share on other sites More sharing options...
Spasmatron Posted September 12, 2012 Share Posted September 12, 2012 Just thought I would add some info to this as it was not previously resolved. The issue is indeed the charset. When creating plain text emails from PHP I also include the following: $mimeandcharset = "MIME-Version: 1.0\r\n"; $mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n"; $headers = "From: $from\r\n"; $headers .= $mimeandcharset; I split this out as often I use the some of the same contents to email myself as well as the user, so in this way you can do the following and the ? sign will display as it should without the annoying ? thing before it: // create the mime and charset variable $mimeandcharset .= "MIME-Version: 1.0\r\n"; $mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n"; // notice I have used utf-8 but you can use what ever you need to, but this will of course affect the use of symbols //create the headers for the email to the site owner $headers = "From: $useremailaddress\r\n"; $headers .= $mimeandcharset; // Send the message to site owner $owneremail = "[email protected]" $subject = "The subject line" $mailtext = "Some text" mail($owneremail, $subject, $mailtext, $headers); // send an email to the website user $custheaders = "From:$owneremail\r\n"; $custheaders .= $mimeandcharset; $body = "A whole bunch of customer service type words that could include the $mailtext too"; mail ($useremailaddress, "Re: $subject", $body, $custheaders); Hope this helps Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-1377180 Share on other sites More sharing options...
Christian F. Posted September 12, 2012 Share Posted September 12, 2012 Please use the tags around your code, as it helps make both your post and your code a lot easier to read. Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-1377182 Share on other sites More sharing options...
Spasmatron Posted September 12, 2012 Share Posted September 12, 2012 Apologies, I am new to this. Here is the amended post: Just thought I would add some info to this as it was not previously resolved. The issue is indeed the charset. When creating plain text emails from PHP I also include the following: $mimeandcharset = "MIME-Version: 1.0\r\n"; $mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n"; $headers = "From: $from\r\n"; $headers .= $mimeandcharset; I split this out as often I use the some of the same contents to email myself as well as the user, so in this way you can do the following and the pound sign will display as it should without the annoying symbol thing before it: // create the mime and charset variable $mimeandcharset .= "MIME-Version: 1.0\r\n"; $mimeandcharset .= "Content-Type: text/plain; charset=utf-8\r\n"; // notice I have used utf-8 but you can use what ever you need to, but this will of course affect the use of symbols //create the headers for the email to the site owner $headers = "From: $useremailaddress\r\n"; $headers .= $mimeandcharset; // Send the message to site owner $owneremail = "[email protected]" $subject = "The subject line" $mailtext = "Some text" mail($owneremail, $subject, $mailtext, $headers); // send an email to the website user $custheaders = "From:$owneremail\r\n"; $custheaders .= $mimeandcharset; $body = "A whole bunch of customer service type words that could include the $mailtext too"; mail ($useremailaddress, "Re: $subject", $body, $custheaders); Hope this helps Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-1377183 Share on other sites More sharing options...
Pikachu2000 Posted September 12, 2012 Share Posted September 12, 2012 Why dredge up a thread that's 31/2 years old? Link to comment https://forums.phpfreaks.com/topic/143484-php-mail-problem/#findComment-1377197 Share on other sites More sharing options...
Recommended Posts