Okay
  Public Ticket #2086812
Contact form auto responder
Closed

Comments

  •  40
    ep started the conversation

    Hello

    Is it possible to set up an auto-responder email with your contact form? (I prefer how your form looks, compared to Contact Form 7 plugin...)

  •  40
    ep replied

    Sorry, I'd like to add further questions please.

    2. When user submits contact form, the email I receive as admin is from "WordPress". Can I change this name?

    3. Can I change the subject line of this email too? Currently it says "New Contact Form message has been received."

    4. Can I change the wording content of this email? Currently it says "You have received new contact form message" and includes IP address etc which I would prefer to remove.

  • [deleted] replied

    Hi ep,

    1. Yes you can add auto respond email but you should do this with custom code, when contact form is submitted this hook is executed:

    medium
    (view large image)

    2. You can change sender email/name with this plugin:

    https://wordpress.org/plugins/wp-default-sender-email-by-it-pixelz/

    3. To change subject you can apply hooks:

    function kalium_contact_form_subject_custom( $subject, $form_fields, $form_options ) {
        // From $form_fields you can access name, email, subject, message
        // For example $form_fields['name']
        return "My custom subject";
    }
    add_filter( 'kalium_contact_form_subject', 'kalium_contact_form_subject_custom', 10, 3 );

    4. To format email body apply this code:

    function kalium_contact_form_message_body_custom( $email_body, $form_fields, $form_options ) {
        $name = $form_fields['name'];
        $email = $form_fields['email'];
        $subject = $form_fields['subject']; // Subject field (different from mail subject)
        $message = $form_fields['message'];
        $custom_body = "From name: $name
    Email: $email
    Subject: $subject
    Message:
    $message
    Best regards";
        return $custom_body;
    }
    add_filter( 'kalium_contact_form_message_body', 'kalium_contact_form_message_body_custom' );
    I hope this will help you.