About the mail().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi lists:

I am new here. And i know little about php. Sorry ask so stupid
question.
I want to use my local /usr/sbin/sendmail to send mail to a certain
address. I have checked the function_list in http://www,php.net.
And i found the mail(). It enough to my requirement.

And i have written a php file like below:

<?php
if($_POST['send']) {
  $message = $_POST['message'];
  $body = "ååï" . $message['username'] . "\n" .
      "éäååï" . $message['usermail'] . "\n" .
      "åååçï" . $message['compname'] . "\n" .
      "çèåçï" . $message['telephone'] . "\n\n" .
      "ééäéï" . $message['subject'] . "\n" .
      "ééååï" . $message['content'] . "\n";

  $headers .= "Content-Transfer-Encoding: UTF-8\n";
  $headers .= "Content-Type: text/plain; charset=utf-8\n";
  $headers .= "MIME-Version: 1.0\n";
  $headers .= "From: help@xxxxxxxxxxx\n";
  $headers .= "X-Mailer: Online Help!(http://www.example.com)\n";

  mail('wangpenghui@xxxxxxxxxx', 'æéèåå! ', $body, $headers);
  header("Location: http://www.example.com";);
}

if($_POST['cancel']) {
  header("Location: http://www.example.com";);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="zh" >
<head>
<title>åçæé</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1 style="text-align:center;color: red">åçåå</h1>
<div style="margin: auto; width: 65%;">
<p>èéæåçååæåïåæææääééæçéïæåäåååååäéïèææäååäåçäæéååæçééïååçæäåå.</p>
<form method="post">
<fieldset>
<legend>æçèçäæ</legend>
æçååï<input type="text" name="message[username]" >
éäååï<input type="text" name="message[usermail]" ><br>
åååçï<input type="text" name="message[compname]" >
çèåçï<input type="text" name="message[telephone]" >
</fieldset>
<fieldset>
<legend>ææéçéé</legend>
äéï<input name="message[subject]" type="text" size="30" value=""
maxLength="100"><br>
ååï<textarea name="message[content]"rows="10" cols="70"></textarea>
<div style="text-align:center">
<input type="submit" name="send" value="åé">
<input type="submit" name="cancel" value="åæ">
</div>
</fieldset>
</form>
</div>
</body>
</html>

But all the chinese words could change to "????". The charset of this
file is UTF-8.
I wonder know how to deal with it. And i am blind with it now. Because
the lack of experience with php.


Best regards

Wang Penghui



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux