XML ສາຍຫຼັກສານ

PHP ອະນຸຍາດທີ່ຈະສົ່ງອີເມວຈາກເຄື່ອງກຳລັງ.

ຫົວຂໍ້ PHP mail()

ຫົວຂໍ້ PHP mail() ການສົ່ງອີເມວຈາກເຄື່ອງກຳລັງ.

ຫົວຂໍ້

mail(to,Required. Specify the email recipient.,Required. Specify the email subject. Note: This parameter cannot contain any newline characters.,Required. Define the message to be sent. Use LF (\n) to separate each line.,parameters)
ມາດຕະາຍ ການອະທິບາຍ
to 必需。规定 email 接收者。
Required. Specify the email recipient. subject
Required. Specify the email subject. Note: This parameter cannot contain any newline characters. message
Required. Define the message to be sent. Use LF (\n) to separate each line.

headers

Optional. Specify additional headers, such as From, Cc, and Bcc.

parameters Optional. Specify additional parameters for the mail sending program.

Note:PHP ຕ້ອງມີລະບົບອີເມວທີ່ຖືກຕິດຕັ້ງແລະກຳລັງດຳເນີນໃນຂັ້ນຕອນເພື່ອເຮັດໃຫ້ພຽງພໍກັບການສົ່ງອີເມວ. ຕົວເລື່ອງທີ່ນຳໃຊ້ແມ່ນການການຕິດຕັ້ງຂອງຕົວເລື່ອງຂອງປະກອບຂໍ້ມູນ php.ini. PHP Mail Reference ManualRead more.

PHP Easy E-Mail

ທາງທີ່ສຸດທີ່ສາມາດສົ່ງອີເມວທີ່ສາມາດທຽບກັບ PHP ແມ່ນສົ່ງອີເມວທີ່ມີຂໍ້ຄວາມ.

ໃນຕົວຢ່າງດັ່ງກ່າວນີ້,ພວກເຮົາກໍານົດປະກອບຂໍ້ມູນ($to, $subject, $message, $from, $headers)ກ່ອນອີກ, ແລະພວກເຮົາໃຊ້ປະກອບຂໍ້ມູນດັ່ງກ່າວໃນຫົວຫນັງ mail() ເພື່ອສົ່ງອີເມວ:

<?php
$to = "someone@example.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

PHP Mail Form

ຜ່ານ PHP,ທ່ານສາມາດສ້າງຟອມຄູ່ລົງສະເໜີຄືນໃນເວັບໄຊຂອງທ່ານ. ຕົວຢ່າງດັ່ງກ່າວນີ້ສົ່ງຂໍ້ຄວາມທີ່ຕ້ອງການໄປທີ່ທີ່ລົງຄຳຖາມ e-mail ຕາມລາຍການ:

<html>
<body>
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ; 
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail( "someone@example.com", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>
</body>
</html>

ກໍລະນີອະທິບາຍ:

  1. ກ່ອນທັງອື່ນ, ເບິ່ງວ່າມີການບັນທຶກຂອງບັນຊີອີເມວຫນັງ.
  2. ຖ້າບໍ່ມີການບັນທຶກ (ອີງຕາມຖ້າເຂົ້າເບິ່ງບັນຊີທຳອິດ), ສົ່ງສະໜາມ HTML.
  3. ຖ້າມີການບັນທຶກ (ຫຼັງຈາກຂັ້ນຕອນການບັນທຶກຂອງບັນຊີ), ສົ່ງອີເມວຈາກບັນຊີ.
  4. ຫຼັງຈາກທີ່ປະຕິບັດຕາມຄຳສັ່ງປະຕິບັດ, ການຊອກຫາບັນຊີສະໜາມທີ່ປະກອບມີຂໍ້ຄວາມການສົ່ງອີເມວງາຍອອກ.

PHP Mail Reference Manual

ສຳລັບຂໍ້ມູນຫນານວຽງຫົວຂໍ້ mail() PHP, ກະລຸນາເຂົ້າຊື່ສະບຸກອອກມາຂອງ PHP Mail.