【问题标题】:Send email with php for wordpress page使用 php 为 wordpress 页面发送电子邮件
【发布时间】:2016-09-03 08:53:37
【问题描述】:

我想为 wordpress 页面创建发送电子邮件表单。 WordPress 不允许使用 php 但我可以通过使用一些插件来使用 php。

问题是我不知道如何创建它。 我不能将 php 文件分开。以下是我的html代码。 请帮我写php代码。 php 应该是单独的,我可以将它插入到页面的顶部或底部。但不在单独的文件中

    <form action="" method="post">
  <div class="form-group">
    <label name="first_name">Name:</label>
    <input type="text" class="form-control">
  </div>
  <div class="form-group">
    <label name="email">Email:</label>
    <input type="email" class="form-control" name="email">
  </div>
  <div class="form-group">
    <label name="subject">Subject:</label>
    <input type="text" class="form-control" name="subject">
  </div>
  <div class="form-group">
    <label name="message">Message:</label>
    <textarea type="textarea" rows="5" class="form-control" name="message"></textarea>
  </div>
  <button type="submit" name="submit" class="btn btn-default">Send</button>
</form>

【问题讨论】:

    标签: php wordpress forms web


    【解决方案1】:

    WordPress 有很多用于发送邮件的有用插件。我建议您检查一下:https://pl.wordpress.org/plugins/contact-form-7/

    如果我的理解正确,您需要一个联系表单来从您的 WordPress 页面发送消息。上面的插件非常适合这样的事情,它提供了设置表单样式的可能性。

    【讨论】:

    • 我不想使用插件
    • 我明白了。所以有一个主题可能会有所帮助 - stackoverflow.com/questions/5335273/… Btw。 - 您可以将您的代码放在同一个文件中,然后您不需要在表单中指定 action
    猜你喜欢
    • 1970-01-01
    • 2014-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 2013-07-13
    相关资源
    最近更新 更多