我试图在我的私人投资组合网站上建立一个联系表格。联系表单和数据库之间的链接。但是现在我想在有人发送填写的表格时收到邮件通知。
提前致谢
答案 0 :(得分:1)
你可以简单地使用它:
mail($to,$subject,$message,$headers);
答案 1 :(得分:0)
//多个收件人
$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>
';
//要发送HTML邮件,必须设置Content-type标头
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
//其他标题
$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));