WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Contact Form 7 not giving me the correct Reply To (5 posts)

  1. justinsias
    Member
    Posted 3 years ago #

    Hi! I am using Contact Form 7 on a site hosted at bluehost.
    The Mail1 Form is set as follows:
    TO: MY COMPANY NAME <myemail@gmail.com>
    FROM: [your-email]

    It appears to be working, but when you go to reply to the message that was sent to mail1, it wants to reply to the default email address for the hosting account.

    The below code appears to be the code making all of that happen, though I am not 100% sure.

    Please let me know if you see anything that might fix this problem.

    function wpcf7_default_mail_template() {
    $subject = '[your-subject]';
    $sender = '[your-name] <[your-email]>';
    $body = sprintf( __( 'From: %s', 'wpcf7' ), '[your-name] <[your-email]>' ) . "\n"
    . sprintf( __('Reply-to: %s', 'wpcf7' ),'[your-name] <[your-email]>' ) . "\n"
    . sprintf( __( 'Subject: %s', 'wpcf7' ), '[your-subject]' ) . "\n\n"
    . __( 'Message Body:', 'wpcf7' ) . "\n" . '[your-message]' . "\n\n" . '--' . "\n"
    . sprintf( __( 'This mail is sent via contact form on %1$s %2$s', 'wpcf7' ),
    get_bloginfo( 'name' ), get_bloginfo( 'url' ) );
    $recipient = get_option( 'admin_email' );
    $additional_headers = '';
    $attachments = '';
    $use_html = 0;
    return compact( 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments', 'use_html' );
    }

    function wpcf7_default_mail_2_template() {
    $active = false;
    $subject = '[your-subject]';
    $sender = '[your-name] <[your-email]>';
    $body = __( 'Message body:', 'wpcf7' ) . "\n" . '[your-message]' . "\n\n" . '--' . "\n"
    . sprintf( __( 'This mail is sent via contact form on %1$s %2$s', 'wpcf7' ),
    get_bloginfo( 'name' ), get_bloginfo( 'url' ) );
    $recipient = '[your-email]';
    $additional_headers = '';
    $attachments = '';
    $use_html = 0;
    return compact( 'active', 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments', 'use_html' );
    }

    function wpcf7_default_messages_template() {
    $messages = array();

    foreach ( wpcf7_messages() as $key => $arr ) {
    $messages[$key] = $arr['default'];
    }

    return $messages;
    }

  2. AllanMackey
    Member
    Posted 3 years ago #

    Just discovered I'm having the very same issue. Reply-to, goes to the original admin address (not even the blog address) instead of the person who sent the contact form. If there's a way to fix it, or get around it, that would be super-peachy.

  3. bh_WP_fan
    Member
    Posted 3 years ago #

    There are a couple of different suggestions given here which may help you: http://wordpress.org/support/topic/plugin-contact-form-7-form-submits-but-no-email-is-received?replies=13

  4. justinsias
    Member
    Posted 3 years ago #

    So far, this is NOT resolved. I have seen many threads where this is NOT resolved. I was hoping that whoever made the plugin might know what the problem is. As of now, it appears easier to build your pwn form than use a plugin. That is sad.

  5. AllanMackey
    Member
    Posted 3 years ago #

    I figured out what the problem was (for me, anyway). I was using the below function to overwrite the default notification name and email address.

    Somehow that conflicted with Contact Form 7, causing it to replace ALL sender info with the admin email info resulting in every form being sent seemingly coming from ourselves. Once I removed the code, the contact form works perfectly well again.

    Of course I'm now left with the original issue, but it's the far lesser of two problems.

    If you're using this function, or something similar, that's probably the problem you're having.

    Function:

    //notification mail email and name change

    add_filter('wp_mail_from','custom_email_from');

    function custom_email_from($mail) {
    // use the original admin email for notifications; adjust the number for different user id
    $user_info = get_userdata(1);
    $email = $user_info->user_email;
    if($email) $mail = $email;
    return $mail;
    }

    add_filter('wp_mail_from_name','custom_email_from_name');

    function custom_email_from_name($name) {
    // set a custom name for notifications
    $name = 'Orleans Taekwondo';
    return $name;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic