Wordpress中的PhP联系人表单 [英] PhP Contact form in Wordpress

查看:82
本文介绍了Wordpress中的PhP联系人表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我购买了一个主题,该主题具有一个简单的PHP联系人表单,该表单允许用户相互发送消息,但是当发件人填写该表单并提交时,该电子邮件来自我的默认Wordpress Admin电子邮件,而不是来自该电子邮件地址的电子邮件。用户以表格形式输入。因此,如果收件人尝试回复他们的电子邮件,它将直接发送给我(管理员),而不是发送电子邮件的人。

So I bought a theme that has a simple PHP contact form that allows users to message each other, but when a sender fills out the form and submits it, the email comes from my default Wordpress Admin email and not the email address the user inputs in the form. So if the receiver tries to reply to their email, it's going to come to me (Admin) and not the person who sent the email.

我在这里错过了一些东西吗……似乎很简​​单。我已经尝试过更改它并使用$ header等,但是没有任何效果……总是来自我的管理员电子邮件。

Am I missing something here...seems pretty straight forward. I've tried changing it up and using $headers, etc., but nothing works... always just comes from my admin email.

以下是表单代码:

<form method="post"><input type="hidden" value="<?php the_ID(); ?>" name="pid_rep" />
     <li>
        <h3><?php echo __('Your Email'); ?>:</h3>
    <p><input type="text" size="50" class="do_input"  name="email" /></p>
    </li>
    <li>
        <h3><?php echo __('Message'); ?>:</h3>
    <p><textarea rows="4" cols="40" class="do_input" name="message"></textarea>
    <<input type="submit" name="contact" value="<?php _e('Send Message'); ?>" /></p>
    </li>
</form>

此处是处理程序:

    $email = $_POST['email'];
    $message = nl2br($_POST['message']);


推荐答案

我知道这是一个WordPress安全设置,您无法更改。电子邮件发件人的域名必须与您的网站域名相同。
可以定义一个自定义(甚至不存在)的发件人电子邮件地址和发件人名称,您可以使用此插件: WordPress联系人表格滑块

As I know it is a WordPress security setting and you can't change it. The email sender's domain name must be equal with your website domain name. Possible to define a custom, even not existing sender email address and sender name, you can do it with this plugin: WordPress Contact Form Slider

这篇关于Wordpress中的PhP联系人表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆