如果(我开始接收垃圾邮件机器人表单)
然后(我使用基本的Honey Pot方法实现了新的PHP Email脚本)
$ ERROR(新PHP没有发送所有表单字段。发送表单后,我的电子邮件只收到,textarea id =“message”,字段)
$ LOG_FILE(我之前的PHP脚本实现了表单字段的动态全能解决方案)
$ FAILED_SOLUTION(相反,我试图在PHP的第6行7&amp; 14行手动添加个人,$ phone&amp; $地址字段,但我仍然只收到,textarea id =“message”,字段)< / p>
$ NOTES(我自学并且通常只在需要知道的基础上处理PHP。请尽量保持简单,并包括逐步解释。随意建议任何“最佳实践”我可能忽略了与我的问题无关!)
$ QUESTION =“有人可以告诉我如何调用PHP脚本中的其他表单字段发送到我的电子邮件吗?”
$ SUCCESS =“提前感谢任何可能给予的帮助!”;
PHP:
<?php
if($_POST){
$to = 'your-email-here@gmail.com';
$subject = 'Contact Form Submission';
$name = $_POST['name'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$email = $_POST['email'];
$message = $_POST['message'];
$robotest = $_POST['robotest'];
if($robotest)
$error = "Spam Protection Enabled";
else{
if($name && $phone && $address && $email && $message){
$header = "From: $name <$email>";
if(mail($to, $subject, $message,$header))
$success = "Your message was sent!";
else
$error = "Error_36 there was a problem sending the e-mail.";
}else
$error = "Error_09 All fields are required.";
}
if($error)
echo '<div class="msg error">'.$error.'</div>';
elseif($success)
echo '<div class="msg success">'.$success.'</div>';
}
?>
HTML表格:
<form method="post" action="Form_Email.php">
<input type="text" id="name" name="name" placeholder="name" required>
<input type="text" id="phone" name="phone" placeholder="phone" required>
<input type="text" id="address" name="address" placeholder="address" required>
<input type="text" id="email" name="email" placeholder="email" required>
<textarea id="message" name="message" placeholder="message" required> </textarea>
<p class="robotic">
<input name="robotest" type="text" id="robotest" class="robotest" autocomplete="off"/>
</p>
<input type="submit" id="SEND" value="Submit">
</form>
答案 0 :(得分:1)
您的邮件目前仅包含[2017-04-26 01:05:02 CDT] Job "maintenance_mode {"enable":true}" has been started
[2017-04-26 01:05:02 CDT] Magento maintenance mode is enabled.
[2017-04-26 01:05:02 CDT] Job "maintenance_mode {"enable":true}" has successfully completed
[2017-04-26 06:24:02 UTC] Job "setup:cache:disable []" has started
Changed cache status:
config: 1 -> 0
layout: 1 -> 0
block_html: 1 -> 0
collections: 1 -> 0
reflection: 1 -> 0
db_ddl: 1 -> 0
eav: 1 -> 0
customer_notification: 1 -> 0
full_page: 1 -> 0
config_integration: 1 -> 0
config_integration_api: 1 -> 0
translate: 1 -> 0
config_webservice: 1 -> 0
[2017-04-26 06:24:02 UTC] Job "setup:cache:disable []" has been successfully completed
[2017-04-26 06:24:02 UTC] Job "setup:component:uninstall {"components":[{"name":"magento/data-migration-tool"}],"dataOption":false}" has started
[2017-04-26 06:24:02 UTC] An error occurred while executing job "setup:component:uninstall {"components":[{"name":"magento/data-migration-tool"}],"dataOption":false}": Component type not set
[2017-04-26 06:24:02 UTC] Job "setup:cache:enable ["config layout block_html collections reflection db_ddl eav customer_notification full_page config_integration config_integration_api translate config_webservice"]" has started
Changed cache status:
config: 0 -> 1
layout: 0 -> 1
block_html: 0 -> 1
collections: 0 -> 1
reflection: 0 -> 1
db_ddl: 0 -> 1
eav: 0 -> 1
customer_notification: 0 -> 1
full_page: 0 -> 1
config_integration: 0 -> 1
config_integration_api: 0 -> 1
translate: 0 -> 1
config_webservice: 0 -> 1
Cleaned cache types:
config
layout
block_html
collections
reflection
db_ddl
eav
customer_notification
full_page
config_integration
config_integration_api
translate
config_webservice
[2017-04-26 06:24:03 UTC] Job "setup:cache:enable ["config layout block_html collections reflection db_ddl eav customer_notification full_page config_integration config_integration_api translate config_webservice"]" has been successfully completed
。如果要附加其他值,请在$_POST['message']
变量上使用连接。
$message
注意:$message .= ($name . $phone . $address . $etc)
构造代表$foo .= $bar
。
不要忘记任何地方的空格或新线等空格。只需连接$foo = $foo . $bar
或' '
。
之后,只需使用"\n"
作为消息发送邮件。