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.

Multiple recipients

  1. Dear people from gravityforms,

    have a question: I found - in your documentation- a beautiful way to change the email adress form a certain form ID like so:

    [php]
    <?php
           add_filter("gform_email_2", "change_email", 10, 2);
    	function change_email($label, $form_id){
           return "Your Email";
    }
    ?>

    But if I use that code twice with different ID's and different adresses, it goes beserk. What I want is to send each form to a different adress. How shall I go about this?

    Kind regards
    S.O.

    Posted 12 years ago on Thursday August 16, 2012 | Permalink
  2. David Peralty

    Can you explain what you mean by "it goes beserk"? Can you paste your two full examples?

    Posted 12 years ago on Thursday August 16, 2012 | Permalink
  3. Be sure you don't use the function name change_email more than once. If you do, you'll get a "Fatal error: Cannot redeclare function change_email". Change the function name or user the same function but be sure to paste the code into your functions.php file only one time.

    Posted 12 years ago on Thursday August 16, 2012 | Permalink
  4. The 'beserkness' is exactly what Chris Hayer describes, it gives the fatal error. And yes, that makes a lot of sense. You mean I can alter the function name so it won't conflict? Sorry, still learning php, but that would be magnificent. I'll try it out and get back to you asap

    Posted 12 years ago on Friday August 17, 2012 | Permalink
  5. Ok, actually, it doesn't work at all,

    the mail just goes to the central mail adress instead of anywhere else. I use the code I mentioned before (minus the unfortunate 2) that ended up in there), but by changing the central email adress in the preferences I found out this code addition to the functions doesn't do anything. You can see the form here: http://www.rawchinaexpo.com/?page_id=38

    Greets
    S.O.

    Posted 12 years ago on Friday August 17, 2012 | Permalink
  6. Can you please email me ( chris@rocketgenius.com ) a WordPress administrator login for your site? I'd like to take a look at how it's configured. It can work, so it's likely just a configuration issue or some issue with your server. Thank you.

    Posted 12 years ago on Friday August 17, 2012 | Permalink
  7. What is it you're trying to do exactly? You said "What I want is to send each form to a different adress. " Email notifications are tied to each form individually, so you can have notifications from each form sent to a unique email address. However, the email address does not change from entry to entry on the same form. Is there some piece of the puzzle I'm missing? Seems pretty straightforward, unless I am missing something. You should not need to add any code to your theme's functions.php if I understand correctly.

    Additionally, you have this code in your theme's functions.php:

    [php]
    add_filter("gform_email_2", "change_email", 10, 2);
    function change_email($label, $form_id){
    	    return "sponsors@rawchinaexpo.com";
    }

    The gform_email filter is intended to change the label for the email field when your form is displayed to the visitor. Is that what you're trying to do?

    We're going to need more details to be able to help you with this one. Please provide as much information as you can about what you would like to do. Thank you.

    Posted 12 years ago on Friday August 17, 2012 | Permalink
  8. What I'm trying to do is to change the email adress the form will be sent to. There are 3 forms on this site and each one has to be sent to a different adress, because they need to be processed by different departments.

    S.O.

    Posted 12 years ago on Saturday August 18, 2012 | Permalink
  9. S.O. : What you want to do is built in. Each form has its own notification. Please see this documentation http://www.gravityhelp.com/documentation/page/Notifications

    For each individual form, there is a notifications tab where you can set the address where you want the notifications to be delivered. There is no need to change anything. Just set the email address for the administrator in each form individually and you will be done. Hover of the name of the form in your WordPress admin and you will see the link to notifications. Click that and you will be able to set a unique email address for each form.

    Screenshot http://minus.com/li9VezqTajsBs

    Posted 12 years ago on Saturday August 18, 2012 | Permalink
  10. Hey, sorry for re-opening this topic,
    but the answer was not the solution to my problem. I solved it in a different way by building a form myself, but I'd like to use this plugin.
    I was not talking about notifications. I really need to know if I can change the form adress, the adress the form is sent to. Each form ID a different receipient. I hope you can answer this soon because I quickly need it.

    To make it more clear, right now the form you send just goes to the central email adress you put into the wordpress back end
    thanks

    Posted 12 years ago on Sunday November 18, 2012 | Permalink
  11. Oh jeez,

    I feel like a fool. Solved it. Why I was confused is that the notification is not only the thing that is sent to the user to tell him his form has been received. But what I am forgetting is that the form is being sent to the wordpress back end itself and what is sent to the central email adress is also a 'notification'. So actually this was a semantics problem, babylonian confusion...

    Changing the gform_notification_email by ID does the trick :)

    Posted 12 years ago on Sunday November 18, 2012 | Permalink
  12. Thank you for the update :-)

    Posted 12 years ago on Sunday November 18, 2012 | Permalink

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