Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MySQL联系人表单在填写表单时发送电子邮件_Php_Mysql_Forms - Fatal编程技术网

Php MySQL联系人表单在填写表单时发送电子邮件

Php MySQL联系人表单在填写表单时发送电子邮件,php,mysql,forms,Php,Mysql,Forms,我试图在我的私人投资组合网站上制作一份联系表。建立了联系表格和数据库之间的链接。但现在我想在有人填写表格时收到邮件通知 提前感谢您可以简单地使用: mail($to,$subject,$message,$headers); //多个收件人 $to = 'johny@example.com, sally@example.com'; // note the comma //主题 $subject = 'Birthday Reminders for August'; //信息 $message

我试图在我的私人投资组合网站上制作一份联系表。建立了联系表格和数据库之间的链接。但现在我想在有人填写表格时收到邮件通知


提前感谢

您可以简单地使用:

mail($to,$subject,$message,$headers);
//多个收件人

$to = 'johny@example.com, sally@example.com'; // note the comma
//主题

$subject = 'Birthday Reminders for August';
//信息

$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Johny</td><td>10th</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';
//附加标题

$headers[] = 'To: Mary <mary@example.com>, Kelly <kelly@example.com>';
$headers[] = 'From: Birthday Reminder <birthday@example.com>';
$headers[] = 'Cc: birthdayarchive@example.com';
$headers[] = 'Bcc: birthdaycheck@example.com';

janfitz回答了这个问题,但我使用的示例代码是:
缺少标题“邮件($to,$subject,$message,$headers);“欢迎使用Stackoverflow!要获得有用的答案,请包含您迄今为止尝试解决此问题的代码,以便我们可以帮助您调试或改进它。这就是它的工作原理。可能的答案太多,或者好的答案对于这种格式来说太长。请添加详细信息,以缩小答案集或隔离可以在几段中回答的问题。我建议你找一个发展论坛(也许?)来概括一下。然后,当/如果您有特定的编码问题,请回到堆栈溢出,我们将很乐意提供帮助。
$headers[] = 'To: Mary <mary@example.com>, Kelly <kelly@example.com>';
$headers[] = 'From: Birthday Reminder <birthday@example.com>';
$headers[] = 'Cc: birthdayarchive@example.com';
$headers[] = 'Bcc: birthdaycheck@example.com';
mail($to, $subject, $message, implode("\r\n", $headers));