我有一个用户报告帖子的表单。它们在文本框中插入消息ID,并从报告所应用的多个单选按钮中进行选择,然后发送表单。
形式:......
<form method="post" action="sendmail.php" name="Email form">
Message ID <input type="text" name="message id" /><br/><br/>
Aggressive conduct <input type="radio" name="option1" value="aggressive contact" /><br/><br/>
Offensive conduct <input type="radio" name="option2" value="offensive conduct" /><br/><br/>
Rasical conduct <input type="radio" name="option3" value="Rasical conduct" /><br/><br/>
Intimidating conduct <input type="radio" name="option4" value="intimidating conduct" /><br/><br/>
<input type="submit" name="submit" value="Send Mail" />
</form>
sendmai.php文件...
<?php
// The message
$message = "message id\option1\option2\option3\option4";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
// Send
mail('info@uni-lad.com', 'report!!', $message);
?>
我收到错误消息:
警告:mail()[function.mail]:“sendmail_from”未在php.ini中设置或 自定义“From:”标题丢失 第9行的C:\ xampp \ htdocs \ mywebsite \ sendmail.php
我该如何解决这个问题?此外,我感觉所有这些都不会发送用户提供的输入
任何人都可以帮忙吗?
答案 0 :(得分:3)
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);