| | |
Hebrew & The mail() Function
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2005
Posts: 1
Reputation:
Solved Threads: 0
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);
?>
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);
?>
•
•
•
•
1. why does a multiline text data get sended as a single line one?
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'.
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
•
•
Join Date: Sep 2009
Posts: 1
Reputation:
Solved Threads: 0
After many trials and errors I've managed to send a simple text Hebrew email using this code:
I don't know if this is important, but I've also used this meta tag in the HTML head:
Guess it won't hurt to have it up there.
PHP Syntax (Toggle Plain Text)
$to = "somebody@mail.com"; $from = "somebodyelse@email.com"; $subject = "Sebject goes here"; $message = "Message text in Hebrew here!"; $headers = "From: $from" . "\r\n"; $headers .= "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/plain; charset=ISO-8859-1"; mail($to, "Subject: $subject", $message, $headers); echo "Email sent!";
I don't know if this is important, but I've also used this meta tag in the HTML head:
PHP Syntax (Toggle Plain Text)
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Last edited by veetee; Sep 21st, 2009 at 11:58 am.
![]() |
Similar Threads
- mail function issue in php (PHP)
- Sending HTML email via PHP mail function (PHP)
- Problems with PHP mail function. (PHP)
- Stuck on Mail() Function (PHP)
Other Threads in the PHP Forum
- Previous Thread: Warning: Cannot modify header information
- Next Thread: PHP array_merge memory limit - Optimise function
Views: 4242 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database dataentry date directory display download dynamic echo email error file files firstoptioninphpdroplist folder form forms freelancing function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial tutorials update updates upload url validation validator variable video web white xml youtube





