Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #16216

    How do I edit the text emailed from the contact form?

    Thanks in advance, -Jeff

    #90620

    Hi steelmillstudio,

    You’ll need to edit the framework file that creates the form generator and email. In your theme files open framework>php>class-form-generator.php

    Search for:

    //autoresponder?

    Regards,

    Devin

    #90621

    Thanks Devin, however, I’m unfortunately not a programmer. I’ve located the file, opened it up and found the autoresponder? you pointed out but am unable to move forward. Any other information you can share or lead me to?

    Best, -Jeff

    #90622

    Hi Jeff,

    In the same file you can find this code:

    /**
    * Send the form
    *
    * The send method tries to send the form. It builds the necessary email and submits it via wp_mail
    */
    function send()
    {
    $new_post = array();
    foreach ($_POST as $key => $post)
    {
    $new_post[str_replace('avia_','',$key)] = $post;
    }

    $mymail = empty($this->form_paramas['myemail']) ? $new_post['myemail'] : $this->form_paramas['myemail'];
    $myblogname = empty($this->form_paramas['myblogname']) ? $new_post['myblogname'] : $this->form_paramas['myblogname'];
    $subject = empty($new_post['subject']) ? __("New Message", 'avia_framework') : $new_post['subject'];

    $default_from = parse_url(get_option('home'));

    //set the email adress
    $from = " (Email address hidden if logged out) ";
    $usermail = false;

    if(!empty($default_from['host'])) $from = "no-reply@".$default_from['host'];

    if(!empty($this->autoresponder[0]))
    {
    $from = $_POST[$this->autoresponder[0]];
    $usermail = true;
    }
    else
    {
    $email_variations = array( 'e-mail', 'email', 'mail' );

    foreach($email_variations as $key)
    {
    foreach ($new_post as $current_key => $current_post)
    {
    if( strpos($current_key, $key) !== false)
    {
    $from = $new_post[$current_key];
    $usermail = true;
    break;
    }

    }

    if($usermail == true) break;
    }
    }

    $to = urldecode( $mymail );
    $from = urldecode( $from );
    $subject = urldecode( $subject . " (".__('sent by contact form at ','avia_framework').$myblogname.")" );
    $message = "";

    foreach($this->form_elements as $key => $element)
    {
    $key = avia_backend_safe_string($key);
    if(!empty($new_post[$key]))
    {
    if($element['type'] != 'hidden' && $element['type'] != 'decoy')
    {
    if($element['type'] == 'textarea') $message .= "<br/>";
    $message .= $element['label'].": ".nl2br(urldecode($new_post[$key]))."<br/>";
    if($element['type'] == 'textarea') $message .= "<br/>";
    }
    }
    }

    $header = 'MIME-Version: 1.0' . "rn";
    $header .= 'Content-type: text/html; charset=utf-8' . "rn";
    $header .= 'From:'. $from . " rn";
    mail($to, $subject, $message, $header);

    //autoresponder?
    if($usermail && !empty($this->form_paramas['autoresponder']))
    {
    $header = 'MIME-Version: 1.0' . "rn";
    $header .= 'Content-type: text/html; charset=utf-8' . "rn";
    $header .= 'From:'. urldecode( $this->form_paramas['autoresponder_email']) . " rn";
    $message = nl2br($this->form_paramas['autoresponder'])."<br/><br/><br/><strong>Your Message:</strong><br/><br/>".$message;
    mail($from, $this->form_paramas['autoresponder_subject'], $message, $header);
    }

    return true;
    //return wp_mail( $to, $subject, $message , $header);

    }

    In this code block, the $message variable controls what appears on the body of the email that will be sent.

    Regards,

    Ismael

    #90623

    Ok, so in my case, the auto-reply email message contains:

    “Thank you for your interest in College & Career Fitness. We look forward to getting back to you.”

    If I want to remove the “” before the “& Career Fitness”

    PLUS change the 2nd sentence in the auto-reply to read, “We look forward to learning more about you and will respond to your message as soon as we are able.”

    I would edit this file?

    #90624

    Hi steelmillstudio,

    Instead of writing:

    “Thank you for your interest in College & Career Fitness. We look forward to getting back to you.”

    Use this one instead:

    “Thank you for your interest in College &amp: Career Fitness. We look forward to getting back to you.”

    Just replace : with ;

    For the last question, Yes, you will edit this file.

    Regards,

    Ismael

    #90625

    Man, I’m just not getting it. . . I don’t see where to add or edit the text I want to change. . . only code. . . I’m not a programmer.

    No solution for me yet here. . .

    #90626

    Hi Jeff,

    Replace this code:

    /**
    * Send the form
    *
    * The send method tries to send the form. It builds the necessary email and submits it via wp_mail
    */
    function send()
    {
    $new_post = array();
    foreach ($_POST as $key => $post)
    {
    $new_post[str_replace('avia_','',$key)] = $post;
    }

    $mymail = empty($this->form_paramas['myemail']) ? $new_post['myemail'] : $this->form_paramas['myemail'];
    $myblogname = empty($this->form_paramas['myblogname']) ? $new_post['myblogname'] : $this->form_paramas['myblogname'];
    $subject = empty($new_post['subject']) ? __("New Message", 'avia_framework') : $new_post['subject'];

    $default_from = parse_url(get_option('home'));

    //set the email adress
    $from = " (Email address hidden if logged out) ";
    $usermail = false;

    if(!empty($default_from['host'])) $from = "no-reply@".$default_from['host'];

    if(!empty($this->autoresponder[0]))
    {
    $from = $_POST[$this->autoresponder[0]];
    $usermail = true;
    }
    else
    {
    $email_variations = array( 'e-mail', 'email', 'mail' );

    foreach($email_variations as $key)
    {
    foreach ($new_post as $current_key => $current_post)
    {
    if( strpos($current_key, $key) !== false)
    {
    $from = $new_post[$current_key];
    $usermail = true;
    break;
    }

    }

    if($usermail == true) break;
    }
    }

    $to = urldecode( $mymail );
    $from = urldecode( $from );
    $subject = urldecode( $subject . " (".__('sent by contact form at ','avia_framework').$myblogname.")" );
    $message = "";

    foreach($this->form_elements as $key => $element)
    {
    $key = avia_backend_safe_string($key);
    if(!empty($new_post[$key]))
    {
    if($element['type'] != 'hidden' && $element['type'] != 'decoy')
    {
    if($element['type'] == 'textarea') $message .= "<br/>";
    $message .= $element['label'].": ".nl2br(urldecode($new_post[$key]))."<br/>";
    if($element['type'] == 'textarea') $message .= "<br/>";
    }
    }
    }

    $header = 'MIME-Version: 1.0' . "rn";
    $header .= 'Content-type: text/html; charset=utf-8' . "rn";
    $header .= 'From:'. $from . " rn";
    mail($to, $subject, $message, $header);

    //autoresponder?
    if($usermail && !empty($this->form_paramas['autoresponder']))
    {
    $header = 'MIME-Version: 1.0' . "rn";
    $header .= 'Content-type: text/html; charset=utf-8' . "rn";
    $header .= 'From:'. urldecode( $this->form_paramas['autoresponder_email']) . " rn";
    $message = nl2br($this->form_paramas['autoresponder'])."<br/><br/><br/><strong>Your Message:</strong><br/><br/>".$message;
    mail($from, $this->form_paramas['autoresponder_subject'], $message, $header);
    }

    return true;
    //return wp_mail( $to, $subject, $message , $header);

    }

    With this code:

    /**
    * Send the form
    *
    * The send method tries to send the form. It builds the necessary email and submits it via wp_mail
    */
    function send()
    {
    $new_post = array();
    foreach ($_POST as $key => $post)
    {
    $new_post[str_replace('avia_','',$key)] = $post;
    }

    $mymail = empty($this->form_paramas['myemail']) ? $new_post['myemail'] : $this->form_paramas['myemail'];
    $myblogname = empty($this->form_paramas['myblogname']) ? $new_post['myblogname'] : $this->form_paramas['myblogname'];
    $subject = empty($new_post['subject']) ? __("New Message", 'avia_framework') : $new_post['subject'];

    $default_from = parse_url(get_option('home'));

    //set the email adress
    $from = " (Email address hidden if logged out) ";
    $usermail = false;

    if(!empty($default_from['host'])) $from = "no-reply@".$default_from['host'];

    if(!empty($this->autoresponder[0]))
    {
    $from = $_POST[$this->autoresponder[0]];
    $usermail = true;
    }
    else
    {
    $email_variations = array( 'e-mail', 'email', 'mail' );

    foreach($email_variations as $key)
    {
    foreach ($new_post as $current_key => $current_post)
    {
    if( strpos($current_key, $key) !== false)
    {
    $from = $new_post[$current_key];
    $usermail = true;
    break;
    }

    }

    if($usermail == true) break;
    }
    }

    $to = urldecode( $mymail );
    $from = urldecode( $from );
    $subject = urldecode( $subject . " (".__('sent by contact form at ','avia_framework').$myblogname.")" );
    $message = "Thank you for your interest in College & Career Fitness. We look forward to getting back to you.nn";

    foreach($this->form_elements as $key => $element)
    {
    $key = avia_backend_safe_string($key);
    if(!empty($new_post[$key]))
    {
    if($element['type'] != 'hidden' && $element['type'] != 'decoy')
    {
    if($element['type'] == 'textarea') $message .= "<br/>";
    $message .= $element['label'].": ".nl2br(urldecode($new_post[$key]))."<br/>";
    if($element['type'] == 'textarea') $message .= "<br/>";
    }
    }
    }

    $header = 'MIME-Version: 1.0' . "rn";
    $header .= 'Content-type: text/html; charset=utf-8' . "rn";
    $header .= 'From:'. $from . " rn";
    mail($to, $subject, $message, $header);

    //autoresponder?
    if($usermail && !empty($this->form_paramas['autoresponder']))
    {
    $header = 'MIME-Version: 1.0' . "rn";
    $header .= 'Content-type: text/html; charset=utf-8' . "rn";
    $header .= 'From:'. urldecode( $this->form_paramas['autoresponder_email']) . " rn";
    $message = nl2br($this->form_paramas['autoresponder'])."<br/><br/><br/><strong>Your Message:</strong><br/><br/>".$message;
    mail($from, $this->form_paramas['autoresponder_subject'], $message, $header);
    }

    return true;
    return wp_mail( $to, $subject, $message , $header);

    }

    Hope this helps.

    Regards,

    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Edit Autoresponder message’ is closed to new replies.