这是我做的一个很简陋的php代码,效果基本没有,感觉逻辑上应该对了,但还得深化,还望大家能够指点一下。
<?php
// 设置接收邮件的邮箱地址
$to = "name@qq.com";
// 获取表单提交的数据
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
// 设置邮件主题和内容
$subject = "New Contact Form Submission";
$body = "Name: $name\nEmail: $email\nMessage: $message";
// 设置发件人信息
$headers = "From: $email";
// 发送邮件
if (mail($to, $subject, $body, $headers)) {
echo "success";
} else {
echo "error";
}
?>
<?php
// 设置接收邮件的邮箱地址
$to = "1459700891@qq.com";
// 获取表单提交的数据
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
// 设置邮件主题和内容
$subject = "New Contact Form Submission";
$body = "Name: $name\nEmail: $email\nMessage: $message";
// 设置发件人信息
$headers = "From: $email";
// 发送邮件
if (mail($to, $subject, $body, $headers)) {
echo "success";
} else {
echo "error";
}
?>