简体   繁体   English

如何从 HTML Elementor 表单发送电子邮件

[英]How to send an email from an HTML Elementor form

I created a form using the HTML Snippets component from Elementor in Wordpress, and now i want to send the data to another .php file to send an email with it, but Wordpress keeps telling me the following:我使用 Wordpress 中 Elementor 的 HTML Snippets 组件创建了一个表单,现在我想将数据发送到另一个 .php 文件以发送电子邮件,但 Wordpress 一直告诉我以下内容:

Failed to open stream: No such file or directory in C:\xampp\htdocs\personalpage\wp-content\send-email.php无法打开流: C:\xampp\htdocs\personalpage\wp-content\send-email.php中没有这样的文件或目录

Any other way i can send an email with the form data?我可以通过其他方式发送包含表单数据的电子邮件吗?

I suggest you to create your custom shortcode in your child theme file functions.php我建议您在子主题文件functions.php中创建自定义简码

<?php
add_shortcode('my_form', 'my_form_callback'); // Use this sortcode in your WordPress page
function my_form_callback($atts) {

    return '
      <form action="' . get_stylesheet_directory_uri() . $atts['link'].'" method="post" enctype="multipart/form-data" accept-charset="utf-8">
        <input>
        ...
      </form>';
}

Then use your shortcode [my_form link="/send-email.php"] , your file send-email.php should be in the same paste of functions.php or edit the action="' . get_stylesheet_directory_uri() . $atts['link'].'" removing and insert the correct local.然后使用你的简码[my_form link="/send-email.php"] ,你的文件send-email.php应该在functions.php的相同粘贴中或编辑action="' . get_stylesheet_directory_uri() . $atts['link'].'"删除并插入正确的本地。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM