User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 426,907 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,307 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2988 | Replies: 1
Reply
Join Date: Apr 2005
Posts: 1
Reputation: guyshahaf is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
guyshahaf guyshahaf is offline Offline
Newbie Poster

Help Hebrew & The mail() Function

  #1  
Apr 21st, 2005
i need to use a php script to recieve an email body text from flash and send that email to a fix address with a fix subject.

i was able to do so but i got stuck with 2 problems:

1. why does a multiline text data get sended as a single line one?

2. The body text alone is in Hebrew and Hebrew ONLY... the email keeps coming in 'Jibrish'.

What can be done about these 2??

P.s.

Here is the php script i use:
<?php
$name = 'Wedding';
$email = 'june9@lycos.co.uk';
$subject = 'Confirmation';
$message=utf8_decode($HTTP_POST_VARS['message']);
$toaddress='haba97@int.gov.il';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=ISO-8859-8' . "\r\n";

mail($toaddress,$subject,$message,"From: $name <$email>", $headers);

?>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 338
Reputation: paradox814 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: Hebrew & The mail() Function

  #2  
Apr 21st, 2005
1. why does a multiline text data get sended as a single line one?
this is because you are sending your e-mail as a html document, you need to insert <br> to break the line, alternatively you could just send it as a plain text email to do that replace
Content-type: text/html;
with this instead:
Content-type: text/plain;

2. The body text alone is in Hebrew and Hebrew ONLY... the email keeps coming in 'Jibrish'.
the emails keep getting sent in Hebew because that is the character encoding you are sending them in. If you want regular latin then modify your last header from this:
charset=ISO-8859-8
to this:
charset=ISO-8859-1

so basically your last header line should look like this:
[php]$headers .="Content-type: text/plain; charset=ISO-8859-1\r\n"[/php]
charset=iso-8859-1

some other headers I would recommend adding are the following:
[php]$headers .= "From: ".$sender_name." <".$_POST['email'].">\r\n";
$headers .= "Reply-To: <".$sender_email.">\r\n";
$headers .= "Return-Path: <".$sender_email.">\r\n";[/php]

obviously there are other headers you could use, but it's always good to have a return path in case whomever you email decides to hit the reply button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:22 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC