Solved

php email - ignores £ in body

Posted on 2012-03-28
7
228 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
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 108

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 21

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 108

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now