Solved

php email - ignores £ in body

Posted on 2012-03-28
7
237 Views
Last Modified: 2012-04-02
Hi

I am sending out an email with php.

If the body of the email contains '£' the whole email is blank.

If I use '£' It simply ignores it.

Here's the basis of the function ..

$header = "Content-Type: text/html; charset=utf8";
$subject = "My Subject Here";
$body1 = "This is the first section where I try £15";
$body2 = "This is the second section where I try £15";
$from = "My From Address";
$language = language_default();
$params = array();
$message['subject'] = $subject;
		$message['body'] = array();
		$message['body'][] = $body1;
		$message['body'][] = $body2;

Open in new window

0
Comment
Question by:eppyfone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 37776216
do u have like this full mime header,


// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
0
 

Author Comment

by:eppyfone
ID: 37776260
Hi

Yes

Still no success..
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 37776269
You probably have other errors, but this line will cause an encoding collision between the unicode marker and the single-byte characters with ordinal values above 128.
$header = "Content-Type: text/html; charset=utf8";

Open in new window

Please read this article about unicode and then post back if you still have questions.
http://www.joelonsoftware.com/articles/Unicode.html

Executive Summary: Remove UTF-8 and insert ISO-8859-1.  But read the article to learn why so you don't have this situation again.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 22

Expert Comment

by:Kim Walker
ID: 37776272
Try quoted_printable_encode your message.
quoted_printable_encode($message);

Open in new window

0
 

Accepted Solution

by:
eppyfone earned 0 total points
ID: 37776740
1. Ray Passeur - thanks for the attempt at trying to teach me to fish. No use. and your Exec Summary didn't work ..

2. xmediaman - nope

Solution by me :

Added this line

            $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';

Thanks for your attention

E.
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 37776773
Yeah, that's the problem with posting little code fragments.  It's almost impossible to guess at what else is going on.  We could see that your script had set a lot of variables, but nowhere was there a function call that used any of those variables.  So all we could do is guess at the more common errors associated with character encodings.

Anyway, glad you've found the issue.  Best regards, ~Ray
0
 

Author Closing Comment

by:eppyfone
ID: 37795082
Solved by research elsewhere.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question