wp_mail只显示消息。忽略其他字段。 (WordPress的)

时间:2013-10-09 11:52:02

标签: wordpress email

WP_Mail仅显示来自用户的消息,并且不显示用户发布的任何数据。我大部分都尝试了所有内容,并在谷歌的3/4页面上寻求帮助,然后在此发布。我还尝试使用$ current_user函数在电子邮件中显示登录信息给管理员。

以下是我尝试使用的代码:

$et_contact_error = true;
    } else if ( empty($_POST['et_contact_title']) || empty($_POST['et_contact_art']) || empty($_POST['et_contact_gen']) || empty($_POST['et_contact_message']) ){
        $et_error_message .= '<p>' . esc_html__('Make sure you fill all fields. ','Lucid') . '</p>';
        $et_contact_error = true;
    }


} else {
    $et_contact_error = true;
    if ( isset($_SESSION['et_first_digit'] ) ) unset( $_SESSION['et_first_digit'] );
    if ( isset($_SESSION['et_second_digit'] ) ) unset( $_SESSION['et_second_digit'] );
}

if ( !isset($_SESSION['et_first_digit'] ) ) $_SESSION['et_first_digit'] = $et_first_digit = rand(1, 15);
else $et_first_digit = $_SESSION['et_first_digit'];

if ( !isset($_SESSION['et_second_digit'] ) ) $_SESSION['et_second_digit'] = $et_second_digit = rand(1, 15);
else $et_second_digit = $_SESSION['et_second_digit'];

if ( ! $et_contact_error && isset( $_POST['_wpnonce-et-contact-form-submitted'] ) && wp_verify_nonce( $_POST['_wpnonce-et-contact-form-submitted'], 'et-contact-form-submit' ) ) {
    $et_email_to = ( isset($et_ptemplate_settings['et_email_to']) && !empty($et_ptemplate_settings['et_email_to']) ) ? $et_ptemplate_settings['et_email_to'] : get_site_option('admin_email');

    $et_site_name = is_multisite() ? $current_site->site_name : get_bloginfo('name');

    $contact_name   = sanitize_text_field( $_POST['et_contact_name'] );
    $contact_email  = sanitize_email( $_POST['et_contact_email'] );

    $headers  = 'From: ' . $contact_name . ' <' . $contact_email . '>' . "\r\n";
    $headers .= 'Reply-To: ' . $contact_name . ' <' . $contact_email . '>';

    **wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ), sprintf( '%s - ' . sanitize_text_field( $_POST['et_contact_title'] ), $et_site_name ), wp_strip_all_tags( $_POST['et_contact_title'] ), apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email, $message ) );**

    $et_error_message = '<p class="contact_info">' . esc_html__('Thanks for contacting us, we will reply to your query within next 48 hours. ','Lucid') . '<a href="#">Back to Home Page</a>' . '</p>';
}

&GT;

我尝试在wp_mail函数中添加所有字段,但它不起作用。

wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ), sprintf( '%s - ' . sanitize_text_field( $_POST['et_contact_title'] ), $et_site_name ), wp_strip_all_tags( $_POST['et_contact_title, et_contact_art, et_contact_gen, et_contact_message'] ), apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email ) );

如果可能的话,使用$ current_user使用wp_mail将电子邮件中的所有字段信息发送给管理员。真的很感激帮助。

0 个答案:

没有答案