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.

Variables in Email Notifications

  1. vaughnk

    Email notifications appear to be limited to a specific email address. That generally being a admin address or the like. Some of the documentation is indicating that you do not have a variable option here, and I just need it confirmed that what I am trying to do is not possible.
    I wish to send a sms confirmation when the user posts the form.
    i.e. user inputs phone number in phone# field
    on submit the notification goes to

    very simple, but possible/not possible ?

    Posted 11 years ago on Monday June 18, 2012 | Permalink
  2. David Peralty

    This is entirely possible. You will want to use the user notification section of the notifications, and put the merge tag in the to field.

    Posted 11 years ago on Monday June 18, 2012 | Permalink
  3. vaughnk

    Thanks David,
    Given your brief response it appears it is rather a simple task, but the documentation I am afraid is not that helpful. Remember that my user will not be logged in, and i am simply trying to construct an email address from data that has been entered.
    From your docs - "Merge Tags"
    " You can use the merge code drop down, also known as the "Insert Form Field" drop down to generate a merge tag. Merge tags are used in the Message field and can also be copy-n-pasted into any of the other Notification fields where appropriate. "

    This doesn't exactly help, as merge tags are an obvious options in the email subject and body only. Your documentation does not freely indicate it can be used in the email send field chosen.
    When editing the default values of an email field, selecting the merge tag drop down does not give you the other fields as options, only usernames,dates etc

    So I think this is how to do it (but it doesn't work)
    phone-field : 6143433233
    email-address :default value set to {custom_field:phone-field:1}

    using this does not produce or build, the 6143433233 is not passed, and you are left with a dud email-address.

    Any help would be great, there does not seem to be any examples of this in support .


    Posted 11 years ago on Tuesday June 19, 2012 | Permalink
  4. vaughnk

    Hi David, No progress at my end. It appears it can not be achieved easily, and maybe should be move to feature request. As other threads are similar.

    Posted 11 years ago on Wednesday June 20, 2012 | Permalink
  5. David Peralty

    V - So here is what I ended up doing.

    1 - Create an e-mail field called hidden
    2 - Go to advanced and give it a class name of hidden
    3 - Use the merge tag for this e-mail field in the notification section (admin or user).
    4 - Create a css class in my style.css

    .hidden {
    display: none;

    5 - In my functions.php file I did the following:

    add_action("gform_pre_submission_3", "pre_submission_handler");
    function pre_submission_handler($form){
        $_POST["input_12"] = $_POST["input_11"] ."";

    You will want to change the _3 and the input numbers with the field id's that make sense to you. You'll also want to change the e-mail address to

    So what I've done is create a hidden field that will be used for the e-mail. This field gets populated on submit with the value of another field and merged with the rest of the e-mail address I want.

    Then this full e-mail address gets sent to our notification system and then WordPress sends out the e-mail for us to the fully realized e-mail address.

    Hope this helps, and sorry about losing you there for a bit.

    Posted 11 years ago on Friday June 22, 2012 | Permalink
  6. vaughnk

    Hi David, thank you for taking the time to do this. Yes it works great.
    I do appreciate your effort, and I made my comments in the other post fully knowing from the traffic on this site, just how busy you guys are. I was just bent out of shape, given you can not use merge fields in the email addresses for some (technical) reason.
    Anyway thank you again it's helped with this problem, and your example has helped me understand your product's features.

    Posted 11 years ago on Monday June 25, 2012 | Permalink
  7. David Peralty

    I'm glad I was able to sort this out for you, and again, sorry about things slipping through the cracks. I hope you'll continue to enjoy the product, and let us know if we can help again in the future.

    Posted 11 years ago on Monday June 25, 2012 | Permalink