PHP php表单邮件:显示确认页面后发送邮件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP php表单邮件:显示确认页面后发送邮件相关的知识,希望对你有一定的参考价值。

<?

ob_start();

?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="content-type" content="text/html;charset=utf-8">
</head><body>

<?
if (isset($_POST["go"])):
?>

  <h2>Thank you for sending the form!</h2>

  <? 

  global $body_for_callback;
  $body_for_callback = $_POST["name"] ." has filled in the form.";
  
  function mail_callback() {
    global $body_for_callback;
    mail("kurt.miebach@example.com","Form result",$body_for_callback);
  }
  register_shutdown_function(mail_callback);
else:
?>
  <form id="orderform" action="#" method="post" name="form1">
  <input type="text" name="name">
  <input type="submit" name="go" value="send form">
  </form>
<?
endif;
?>		
</body></html>
<?
header("Connection: close");
$size = ob_get_length();
header("Content-Length: $size");
ob_end_flush();
flush();
?>

以上是关于PHP php表单邮件:显示确认页面后发送邮件的主要内容,如果未能解决你的问题,请参考以下文章

PHP 确认邮件

每次刷新页面时,PHP 电子邮件表单都会发送电子邮件

发送带有希腊字符的电子邮件无法正确显示(使用HTML,Javascript,PHP)

发送电子邮件[关闭]

用户注册后如何发送验证/确认电子邮件

PHP 单选按钮 - 出错后保留表单中的值