使用php [重复]从html表单发送电子邮件(Sending email from html form using php [duplicate])
这个问题在这里已有答案:
- PHP邮件功能没有完成发送电子邮件 24个答案
我一整天都在尝试这个,但我无法弄清楚如何从我的html联系表单发送一封电子邮件,其中包含表格中的信息到我的电子邮件地址。 我是php新手。
我已经尝试通过将其上传到免费的虚拟主机来运行它。 我得到的消息是“成功!” 当我按下html表单上的提交按钮但实际上没有发送电子邮件时。
任何帮助表示赞赏。
PHP脚本:
<?php //Subject $subject ="Contact Form Submission"; // Name $name =$_POST['InputName']; // Message $message =$_POST['InputMessage']; //Mail of Sender $email =$_POST['InputEmail']; //From $header = "From:$name<$email>"; $send_contact=mail("myemail@gmail.com",$subject,$message,$header); //Check if mail was sent if($send_contact){ echo "Success!"; } else { echo "Error!"; } ?>
编辑:经过一整天的反复试验后想出来。 问题在于我使用的免费网络主机。 更改了主机,代码开始正常工作。 希望这可以帮助将来的某个人。 谢谢大家的帮助。
This question already has an answer here:
Ive been trying this out the whole day but I cant figure out how to send an email from my html contact form containing the information from the form to my email address. Im new to php.
Ive tried running this by uploading it to free web hosting. I get the message "success!" when I press the submit button on my html form but no email is actually sent.
Any help is appreciated.
PHP script:
<?php //Subject $subject ="Contact Form Submission"; // Name $name =$_POST['InputName']; // Message $message =$_POST['InputMessage']; //Mail of Sender $email =$_POST['InputEmail']; //From $header = "From:$name<$email>"; $send_contact=mail("myemail@gmail.com",$subject,$message,$header); //Check if mail was sent if($send_contact){ echo "Success!"; } else { echo "Error!"; } ?>
EDIT: Figured it out after one whole day of trial and error. The problem was with the free web host I was using. Changed hosts and the code started working fine. Hope this helps someone in the future. Thanks all for the help.
原文:https://stackoverflow.com/questions/39062332
最满意答案
Kafka Connect可以处理流数据,并且更灵活一些。 如果您只是弹性,Filebeat是一个干净的日志源集成。 但是,如果您从Kafka到许多不同的水槽,Kafka Connect可能就是您想要的。 我建议您查看连接器集线器以查看当前可供您使用的开源连接器的一些示例http://www.confluent.io/product/connectors/
Kafka Connect can handle streaming data and is a bit more flexible. If you are just going to elastic, Filebeat is a clean integration for log sources. However, if you are going from Kafka to a number of different sinks, Kafka Connect is probably what you want. I'd recommend checking out the connector hub to see some examples of open source connectors at your disposal currently http://www.confluent.io/product/connectors/
相关问答
更多-
将设置添加到filebeat.yml 您可以在路径中看到输出日志作为文件,以查看发生的情况。 output.file: # Boolean flag to enable or disable the output module. enabled: true # Path to the directory where to save the generated files. The option is # mandatory. path: "your path" # Name of the generat ...
-
无法将Filebeat连接到logstash以使用ELK进行日志记录(Unable to connect Filebeat to logstash for logging using ELK)[2023-01-14]
您的filebeat.yml看起来无效。 输出部分缺少缩进: output.logstash: hosts: ["10.10.XX.XX:5044"] 通常,检查配置文件的正确性以确保它们没问题。 例如,对于filebeat,您可以运行: filebeat -c /etc/filebeat/filebeat.yml -configtest 如果您有任何错误,它会解释该错误是什么,以便您可以解决它。 您也可以对其他ELK服务使用类似的方法 Your filebeat.yml looks invalid ... -
Kafka Connect可以处理流数据,并且更灵活一些。 如果您只是弹性,Filebeat是一个干净的日志源集成。 但是,如果您从Kafka到许多不同的水槽,Kafka Connect可能就是您想要的。 我建议您查看连接器集线器以查看当前可供您使用的开源连接器的一些示例http://www.confluent.io/product/connectors/ Kafka Connect can handle streaming data and is a bit more flexible. If you a ...
-
我们的想法是在每个收集日志和统计信息所需的服务器上安装Filebeat。 每个Filebeat实例都会尽可能快地抓取和发送日志,而无需对可以进行大量处理和过滤的集中式Logstash实例进行任何处理。 以前,Logstash有一个轻量级的logstash-forwarder模块,它可以执行与Filebeat大致相同的工作。 Filebeat是集中来自所有不同主机的日志的新官方和标准方法。 The idea is to install Filebeat on every server you need to ...
-
我可以看到本主题中提到的两个问题。 让我为自己的利益进行总结,并希望其他参与者也在为这个问题而努力。 格式在filebeat探矿器中添加标签(每个探矿者标签自5.0或1.2.3开始可用) 坏: fields: tags: mytag 好: fields: tags: ["mytag"] 但是,还有更重要的问题 标签被连接起来。 我们希望标签是一个数组,但是如果我们将新添加的标签发送到logstash,我们会在ES中看到它们是串联的字符串。 如果您只添加一个标签,则解决方法 ...
-
将文件内容从filebeat发送到logstash时发出(Issue while sending file content from filebeat to logstash)[2023-11-15]
你走在一条好路上。 请确认以下内容: 在你的filebeat.yml文件中,确保你没有在output.logstash:行中有注释,这与你的更改编号2相对应。 确保你的信息正确无误。 在logstash管道配置文件中添加以下输出。 输出{stdout {codec => json}} 3.在调试模式下启动logstash。 4.如果您正在阅读具有相同内容的相同文件,请确保在filebeat中删除注册表文件。 ($ filebeatHome /数据/注册表) 5.阅读日志文件。 You are in a go ... -
当您将Beats与Logstash结合使用时,您会遇到一种称为“背压管理”的东西 - 例如,如果网络出现问题,Beats将停止使用消息充斥Logstash服务器。 使用Beats的另一个好处是,在Logstash中,您可以拥有持久队列,这可以防止您在弹性搜索群集出现故障时丢失日志消息。 因此Logstash会将消息保留在磁盘上。 请注意,因为如果您使用UDP,Logstash无法确保您不会丢失消息, 此链接将非常有用。 When you couple Beats with Logstash you have ...
-
如何使用Logstash / Filebeat和Grok过滤JSON(How to filter JSON using Logstash / Filebeat and Grok)[2022-03-17]
您需要使用grok过滤器解析message然后才能应用JSON过滤器 。 如果您可以修改应用程序的记录器配置以输出纯JSON,那么就更好了,因此根本不需要grok解析。 filter { # Parse the log message. grok { pattern_definitions => { "LOGDATE" => "[\d]{4}-[\d]{2}-[\d]{2} %{TIME}" "LOGHEADER" => "%{LOGDATE:logdate} % ... -
不,使用beats协议的文件输出不适用于tcp输入。 您可以选择如何解决此问题。 升级Logstash:在我推荐任何黑客或使用已弃用的软件之前,最好的选择只是将logstash升级到现代版本,几乎没有重大变化和大量性能升级。 手动将节拍输入添加到Logstash:您可以使用/opt/logstash/bin/logstash-plugin install logstash-input-beats将节拍输入添加到logstash 2.x 使用logstash-forwarder:不推荐使用Filebeats的 ...
-
Beats和Logstash之间的连接不基于HTTP协议,因此不要使用URL配置hosts选项。 每个Logstash主机的格式应为host:port 。 正如您从错误消息中看到的那样,它正在尝试解析您指定为域名的完整值,这是错误的(即它与nslookup "http://localhost:5044/"相当)。 问题中显示的配置中的缩进也是关闭的。 hosts设置应该是logstash的子项,因此需要缩进。 尝试使用它来避免任何缩进问题: output.logstash.hosts: ['logstash ...