473,382 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Problem with character encoding in mail

35
Hello!

I'm using a form to send a mail using PHP's mail() function. I'm having some trouble getting the character encoding just right. I need it to be in UTF-8 since i want Swedish characters allowed.

Setup is the following: the form is in UTF-8. The information is sent using an Ajax call to a php file that is encoded in UTF-8. Then, I send the mail with:
Expand|Select|Wrap|Line Numbers
  1. $header = "";
  2. $header .= "Reply-To: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n";
  3. $header .= "Return-Path: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n"; 
  4. $header .= "From: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n";
  5. $header .= "Organization: xxx \r\n"; 
  6. $header .= "Content-Type: text/plain; charset=utf-8\r\n";
  7.  
  8. $sent = mail("xxx", "Subject with Swedish chars", $message, $header);
Now, sending this to a gmail address works fine, no problems at all with the encoding. My work mail approves of it too (it puts it in quarantine but that's a later question :)), but Hotmail doesn't like it, it destroys the special characters in the "mail list" view.

Where am I going wrong? :)
Feb 24 '10 #1
3 4718
Dormilich
8,658 Expert Mod 8TB
@brixton
nowhere, it seems a common problem that Hotmail doesn’t support UTF-8. you can either try to set the charset to UTF-8 manually or send the data converted in Latin-1.
Feb 24 '10 #2
brixton
35
OK, thanks for the reply. I've been fiddling with utf8_encode / utf8_decode back and forth and this only screws up the result i Gmail and my work mail, so I think I'll accept the fact that Hotmail will mess it up (though it only does so in list view, not when viewing the full mail.

Another thing, using these headers my mail gets stuck in quarantine at my work mail. Can you see anything my header is lacking for it to get through that spam filter?
Feb 25 '10 #3
Dormilich
8,658 Expert Mod 8TB
I think that’s nothing that can be easily fixed by something like changing a header (otherwise spammers would already have done that), although I’m not an expert in this field.
Feb 25 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jim Cobban | last post by:
I must be missing something. I am using org.apache.xml.serialize.XMLSerializer to save a DOM but I am not getting non-basic characters converted to UTF-8. I create Text nodes in the DOM by,...
7
by: Jos van Uden | last post by:
Can somebody explain why the following file has the wrong output: <?xml version="1.0" encoding="iso-8859-1"?> <test> <elem>‘bla bla bla’</elem> </test> Expected: ‘bla bla bla’ output: ?bla...
4
by: Krishna A.M | last post by:
Hi, How do i add a hyperlink to a email id having special characters? I tried the same , say mailto: test_&_send@hoohoo.com IN the to box i can see only till test_ and the rest is omitted. ...
1
by: Aleksey | last post by:
Hello, I have the following problem working with DatabaseMetaData. There is a database with table and attribute names in Russian. Database cluster was initialized with appropriate...
3
by: Ekempd | last post by:
I'm trying to read the following XML file: <mail> <from>Rae</from> <subject>Informacion de su Proceso de Titulacion</subject> <body_mail> <!]> </body_mail> </mail>
2
by: Mats-Lennart Hansson | last post by:
Hi, I want to get the ANSI value (0-255) of a character. Assume I create a character like this: string s = new string((char) 151, 1); Now I want to get the ANSI value (151) for this...
5
by: Lenard Gunda | last post by:
hi! I have the following problem. I need to read data from a TXT file our company receives. I would use StreamReader, and process it line by line using ReadLine, however, the following problem...
40
by: Shmuel (Seymour J.) Metz | last post by:
I'd like to include some Hebrew names in a web page. HTML 4 doesn't appear to include character attributes for ISO-8859-8. I'd prefer avoiding numeric references, e.g.,...
37
by: Zhiv Kurilka | last post by:
Hi, I have a text file with following content: "((^)|(.* +))§§§§§§§§" if I read it with: k=System.IO.StreamReader( "file.txt",System.Text.Encoding.ASCII); k.readtotheend()
1
by: PHP Wooer | last post by:
Can anybody there please help me out? I am having a problem with the display of Japanese character in the subject line of the mails sent in Japanese language. This problem is particularly with...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.