We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 70
    • 23 Posts
    re: ContactForm coding question, $email alternate recipient

    1. I would like to use some other email address other than that which is profiled in the system configuration, but I am a little confused about how to setup.
    Should this line read, syntactically ?
    $email = (isset($sendTo))? $sendTo : ’[email protected]’;
    -or-
    $email = (isset($sendTo))? $sendTo : "[email protected]";
    -or-
    //[[ContactForm? &sendTo=`[email protected]`]]
    $email = (isset($sendTo))? $sendTo : ’[[ContactForm? &sendTo=`[email protected]`]]’;

    2. $subject_array[] = "some value" , where is this used in the form or post. I understand the reasoning, but don’t see where or how the sender would select an appropriate subject ??

    // Generic email to use for all parts. You can edit
    // the individual instances for more control.
    // Defaults to the built-in email notification account which is set in the System Configuration.
    // Can be set by using as follows:
    // [[ContactForm? &sendTo=`[email protected]`]]
    $email = (isset($sendTo))? $sendTo : '[(emailsender)]';
    
    
    // enter "static" in order to use the static subject line
    $subject_type = "static";
    $static_subject = "[Web Inquiry] ".$modx->config['site_url'];
    
    // Otherwise use an array of possible subjects
    $subject_array[] = "Survey Info";
    $subject_array[] = "Company Info";
    $subject_array[] = "Other Info";
    
    // Recipient ... add or remove lines as needed
    // Format (as few or as many as desired): 
    // $recipient_array["Your Text Here"] = '[email protected]';
    $recipient_array["General Inquiries"] = "$email";
    $recipient_array["Press or Interview Request"] = "$email";
    $recipient_array["Partnering Opportunities"] = "$email";
    
    // enter "static" in order to use the solo recipient
    $recipient_type = "";
    $static_recipient = "$email";
    


    Thanks
    Don
      I am but a dwarf in a land of giants... with propellars, calculators, bluetooth and beepers smiley
    • On #2, there’s several coding omissions that prevent the subject array from showing up (it’s a bug).

      On #1, either of your first two options should work (single or double quotes). You can also define multiple recipeints like:

      or
      Mr. Blah <[email protected]>, Mrs. Blah <[email protected]>
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me