PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How can I send more than one admin notification?

  1. Hi! I'd like to send more than one admin notification email after a form submission. I'd like to send the full results of the form to one admin email, and just the phone number field to another admin email. How can I do this? Custom code isn't a problem.

    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  2. It does not sound like you could use a conditional shortcode, since you always want to send two different notifications, correct?

    I think I would use the regular admin notification email of {all_fields} for your full notification, and then use the gform_after_submission hook to send a simple email to your other address which would include just the phone number field. http://www.gravityhelp.com/documentation/page/Gform_after_submission

    The function you write could be as simple as:

    [php]
    <?php
    // change the 88 here to your form ID
    add_action('gform_after_submission_88', 'email_phone_number', 10, 2);
    function email_phone_number($entry, $form) {
        // change the 5 here to the field ID where your phone number is stored
        $phone = $entry['5'];
        // set your second admin email address here
        wp_mail('admin2@example.net', 'Phone Number from form submission', $phone);
    }

    You can get creative with the Subject line by including $entry details or $form details.

    Documentation for wp_mail: http://codex.wordpress.org/Function_Reference/wp_mail

    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  3. That could work, thanks!

    Posted 11 years ago on Wednesday January 23, 2013 | Permalink
  4. KSILVER2
    Member

    Now that helped me today!

    Thanks!

    Posted 11 years ago on Friday February 1, 2013 | Permalink
  5. I'm happy that helped you Karl.

    Posted 11 years ago on Saturday February 2, 2013 | Permalink
  6. Hi,

    Glad I found this thread. I am using Gravity Forms for an enquiry form on a client website. Depending on the enquiry type - which is defined by a select box in the form - the form currently sends the regular admin notification email of {all_fields} to one of three email addresses using the email routing function in the 'Notifications' section. For these three enquiry types, the notification email itself is the same. Gravity Forms currently handles this very well.

    My client wants to add a new enquiry type, but for this enquiry type I would need to send a plain-text email containing form fields in JSON to a separate email address which then sucks the info into Pipedrive CRM.

    Is this possible? :-/

    John

    Posted 11 years ago on Wednesday February 6, 2013 | Permalink
  7. This is possible using exactly the method I describe here:
    http://www.gravityhelp.com/forums/topic/how-can-i-send-more-than-one-admin-notification#post-129730

    You will have to create your own JSON message from your entry details and then send the email as described.

    Posted 11 years ago on Wednesday February 6, 2013 | Permalink
  8. Hi - sorry about this but I don't understand completely how to implement it!

    Your example seems to automatically send two types of notifications. I have email routing sending the notification to different email addresses depending on the value of a select box on the form ('enquiry type'). I want the second notification type to be sent instead of the standard one if a specific type of enquiry is chosen in the form. The JSON code itself will be supplied by a developer so I can paste that into wherever it is supposed to go. Help!

    Posted 11 years ago on Wednesday February 6, 2013 | Permalink
  9. @jossoway, I see you opened a new topic here:
    http://www.gravityhelp.com/forums/topic/different-notifications-based-on-conditional-logic-in-form

    Thank you.

    Posted 11 years ago on Thursday February 7, 2013 | Permalink

This topic has been resolved and has been closed to new replies.