我复制了一些 PHP 邮件程序,并在某些时候让它工作了。但问题是,我认为它缺少我特别想要的东西,我需要使最终的电子邮件输出显示如下:
姓名:[此处为发件人姓名]
主题:[此处为主题]
消息:[此处为消息]
看看上面的格式是否可以完成我想在某个时候添加一个公司输入字段。这是他下面的php邮件:
<?php
//print_r($_POST);
if(isset($_POST['_save'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = $_POST['subject'];
if (empty($name) || empty($email) || empty($subject) || empty($message)) {
if (empty($name))
$error['name'] = "Please enter your Full Name";
if (empty($email))
$error['email'] = "Please enter a valid Email Address";
if (empty($subject))
$error['subject'] = "Please Write a Subject";
if (empty($message))
$error['message'] = "lease write a message, inquiries or other concerns above";
}
else { //if not empty
$headers="From: {$email}\r\nReply-To: {$email}"; //create headers for email
mail('email@domain.com',$subject,$message,$headers); //mail the message;
$success = "Thank you! You're email has been sent.";
#done;
}
}
?>