ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

email:contact_form - can't use user defined global variable as recipients

May 04, 2009 12:49pm

Subscribe [3]
  • #1 / May 04, 2009 12:49pm

    CharlieDuncan

    8 posts

    I defined a new global variable contact_recipients to hold the email address of the recipeint, change the invocation to read

    {exp:email:contact_form redirect="3" user_recipients="false" recipients="{contact_recipients}" charset="utf-8"}

    and get back: “Your email had no valid recipients.” when I submit.

    If I place {contact_recipients} as text inside the email form it seems to have the correct value.

    Am I doing anything wrong?

  • #2 / May 04, 2009 12:58pm

    Sue Crocker

    26054 posts

    Charlie, see this thread about using Fresh Variables instead.

  • #3 / May 04, 2009 12:58pm

    Lisa Wess

    20502 posts

    This is a limitation of user defined global variables:

    Also note that Global Variables are one of the last things parsed in your Templates. This means that you cannot use a Global Variable as the value for an EE Tag parameter.

    You could use Fresh Variables for this instead.

  • #4 / May 04, 2009 1:01pm

    CharlieDuncan

    8 posts

    I defined a new global variable contact_recipients to hold the email address of the recipeint, change the invocation to read

    {exp:email:contact_form redirect="3" user_recipients="false" recipients="{contact_recipients}" charset="utf-8"}

    and get back: “Your email had no valid recipients.” when I submit.

    I fixed it by changing my call to

    {exp:email:contact_form redirect="3" user_recipients="false" recipients=contact_recipients charset="utf-8"}

    Why? I thought the {} was required for variable substitution. Now does this mean that the global variable has to contain quotes if has multiple recipients? (Posted after Lisa and Sue’s responses, question still remains)

    Correction: I didn’t fix it I made the error message go away. Will RTFM as suggested

  • #5 / May 04, 2009 1:15pm

    Sue Crocker

    26054 posts

    Charlie, let us know when you get this working.

  • #6 / May 04, 2009 1:46pm

    CharlieDuncan

    8 posts

    Working now. Thanks for your help

  • #7 / May 04, 2009 3:49pm

    Ingmar

    29245 posts

    Glad to see Sue was able to help 😊 Please don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases