Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 1st, 2008, 2:36 PM   #1
Logical1
Programmer
 
Logical1's Avatar
 
Join Date: Apr 2008
Posts: 47
Rep Power: 0 Logical1 is on a distinguished road
Question Mail sent by PHP

In one of my pages the user will receive a confirmation email which thanks him / her for her input. Problem is that this page is made in another language (Persian font) and when I get my test emails they all look like
???? ?? ?????? ?? ????? ??????

in the php pages everything works fine becasue I save them as UTF-8 can this be somehow added to email?
In onther work fot gets lost.
The code I am using for email is shown bellow. What should I add to this to solve this problem?
Thanks in adavnce

if($Email !="")
{
$Emaill = $Email;
$subject = "آگهی شما دریافت شده و ظرف چند ساعت دیگر مطالعه و به ب سایت اضافه می شود. این کپی شماست";
$additionn ="FROM: 123@123.com";
$message = "شماره آگهی شما \"".$RecID."\".
عنوان: ".$Title."\".
ایمیل:".$Email."\".
آدرس:".$Address."\".
شخص مسئول تماس:".$Contact."\".
متن آگهی:".$ADTEXT."\"";
@mail ("$Emaill","$subject","$message","$additionn");
}
__________________
^c^
Logical1 is offline   Reply With Quote
Old Jun 2nd, 2008, 1:25 PM   #2
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Re: Mail sent by PHP

Take a look at the php functions utf8_encode and utf8_decode. If not it may be an error with your mail viewer program or the smtp server which sends the mail. Try putting the results into a binary file which you can then view independently of your browser.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Jun 2nd, 2008, 10:59 PM   #3
Logical1
Programmer
 
Logical1's Avatar
 
Join Date: Apr 2008
Posts: 47
Rep Power: 0 Logical1 is on a distinguished road
Re: Mail sent by PHP

Thank you for your suggestion. I tried it I am still getting exactly what I copy bellow:

This is eactly how the raw data looks in the tables in MySQL altough when they come to the PHP pages they look fine in the correct font. I thinkt the data is there we are missing some translation.
Does this ring any bells?

Ú?Ù^Ù? درخÙ^است ارساÙ" Ù?سخÙ? Ø®Ù"اصÙ? شدÙ? Ù^ Ú©Ù"Ù.Ù? رÙ.ز Ø¢Ú¯Ù?ÛO شارÙ? "40 here is a copy of the information:".
عÙ?Ù^اÙ?: Ù^ÛOÙ"ا دربابÙ"سر کراÛOÙ? تÙ.اÙ. تابستاÙ?".
گرÙ^Ù?:Ù.عاÙ.Ù"ات Ù.Ù"Ú©ÛO-براÛO کراÛOÙ?".
Ú©Ù"Ù.Ù? رÙ.ز براÛO تغÛOÛOر: 1234".
تÙ"فÙ?: 311-321-88111-0".
اÛOÙ.ÛOÙ":123@123.com".
آدرس:".
شخص Ù.سئÙ^Ù":Ø¢Ù,اÛO جÙ.اÙ"ÛO".
Ù.تÙ? Ø¢Ú¯Ù?ÛO:Ù^ÛOÙ"ا دربابÙ"سر کراÛOÙ? تÙ.اÙ. تابستاÙ?
Ù^ÛOÙ"ا دربابÙ"سر کراÛOÙ? تÙ.اÙ. تابستاÙ?
Ù^ÛOÙ"ا دربابÙ"سر کراÛOÙ? تÙ.اÙ. تابستاÙ?"
Ø�*اÙ"ا Ù.ÛO تÙ^اÙ?ÛOد بÙ? صفØ�*Ù?
Ù.راجعÙ? Ú©Ù?ÛOد Ù^ با اÛOÙ? Ú©Ù"Ù.Ù? رÙ.ز Ø¢Ú¯Ù?ÛO تاÙ? را تغÛOÛOر دÙ?ÛOد.
__________________
^c^

Last edited by Logical1; Jun 2nd, 2008 at 11:25 PM.
Logical1 is offline   Reply With Quote
Old Jun 2nd, 2008, 11:59 PM   #4
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Re: Mail sent by PHP

All I can think of is that whatever font your viewer might be using doesn't have a Persian unicode set.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote
Old Jun 3rd, 2008, 10:14 AM   #5
Logical1
Programmer
 
Logical1's Avatar
 
Join Date: Apr 2008
Posts: 47
Rep Power: 0 Logical1 is on a distinguished road
Additional info

I did a lot of tests.
I can get emails with Persian or arabic fornts witout any problems but when sending them to myself as a test Outlook express gives me option of sending them as UNICODE or not. If they are Unicode then I can view them witout any problem. So problem must be how to send an email using PHP with UNICODE.
It must have something to do with information in the header. So far I have not been able to find anything on it. If you can find anything let me know.
Thanks a bunch in advance
L1
__________________
^c^
Logical1 is offline   Reply With Quote
Old Jun 6th, 2008, 6:45 PM   #6
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 218
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
Re: Mail sent by PHP

You need to encode the email message in order to send it. In PHP this is done with the mbstring extension, so make sure you have that, then use the mb_send_mail function instead of the regular mail one
http://us3.php.net/mb_send_mail

how to setup mbstring and then send mail - http://www.advogato.org/article/812.html
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi
freelance scripts - http://ryanguthrie.com/index.html
Mocker is offline   Reply With Quote
Old Jun 7th, 2008, 12:48 PM   #7
Logical1
Programmer
 
Logical1's Avatar
 
Join Date: Apr 2008
Posts: 47
Rep Power: 0 Logical1 is on a distinguished road
tx

Thank you I was stuck for days trying to figure out this simple thing.
__________________
^c^
Logical1 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP problem zanatos PHP 3 Apr 12th, 2008 12:09 AM
New PHP Based Forum-RPG dizdain Paid Job Offers 5 Dec 3rd, 2007 2:32 AM
google mail vs yahoo mail hoffmandirt Coder's Corner Lounge 23 Sep 7th, 2006 2:22 PM
Php Tutorial 3 bulio PHP 4 Jul 16th, 2006 4:00 AM
Php Tutorial 1 bulio PHP 17 May 29th, 2006 4:54 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:11 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC