The recipients model is used to create email groups. Recipient groups are primarily used by the mailform model however they can also be used by custom applications. Enter one row for each recipient and one column for each group and use the intersection of rows and columns to define which users belong to which groups. Consider the following recipient definition: Column 3 is a built-in recipient group called sandbox. Whenever emails are sent from the sandbox environment, the normal recipient setting will be ignored and, instead, the email will be sent to the sandbox group. This is done to avoid sending end users emails that are triggered from the sandbox during development and testing. Of course you can force sandbox emails to go to certain end users by adding the users to the sandbox group. Insert new columns for each group you wish to create and be sure to set the column heading to the group identifier. In the example above there are two groups: executive and inquiries. Users can belong to any number of groups (recipient lists). Stow the recipients definition when finished. You do not need to give it a name since it is always called recipients. Dynamic Email Addresses and NamesSometimes you don't know in advance who should be included on an email list. For example, you may want to send the originator of an email (the person who submitted the request form that triggered the email) a copy of the email. This can be done by using dollar functions in place of actual email addresses. For example, suppose you have a contact form containing the following fields: Let's add the web user's name and email address to a recipient list so that they are copied on the forms that they submit. Notice that we have used the $post function to generate the values based on the current posted values. This option will work provided these fields are available on the final form that is posted to trigger the transaction that caused the email to be sent. If these fields are not on the final form you could write the desired values to a session variable and use $session to generate the dynamic email address value. Sandbox EmailsAs we have described you can designate an alternate set of users to receive emails sent from the sandbox. If there are many developers working on a site you may not want to send all sandbox emails to all developers. The system supports an additional override feature that is triggered when the user submitting the form is logged into the website. If the logged in user has an email address associated with their login, this is saved in the session variable $_SESSION['_user']['email']. If this session variable is set, the sandbox email will be sent only to this user. Therefore, if you are a developer of a website and you want to test a webform you can simply log into the site to be tested before submitting the form and, in such a case, the generated emails will only be sent to you. In cases where no email addresses are indicated under the sandbox recipient for a particular site, you can also designate a default email address to be used by supplying a line of code similar to the following in the sandbox config file (located in private_data/system/config).
|