Configure the Send An E-mail Action
Use the Send an e-mail action when you want to send an email as part of a rule action. For example, you may have a form for registering new students. After completing the form fields, someone clicks a button to create the record. The student receives an email confirmation that shows their new student ID. In this example, there is no workflow involved so the email action takes place as part of a rule instead of being generated from a workflow step.
Example: Clicking the Create Button executes a rule on the view. The rule creates a new record in the underlying SmartObject and sends an email confirmation that includes the student's ID.
Find the Send an e-mail action in the Notifications group.
Rule Breakdown
In this example, the rule fired is When Create Button is Clicked. This rule executes when someone clicks a button on the view, and the first rule action creates a new record in the underlying SmartObject. After the record is created, a second action sends an email confirmation which includes the new student's ID.
Item | Rule Action | Notes |
---|---|---|
A | then execute the Create method | The first rule action creates a new record in the Students SmartObject using content entered on the view (Student Name, Student Email). |
B | then send an e-mail | The second rule action sends an email to the address entered in the Student Email Text Box. The email includes the Student ID, which is the Students (SmartObject) > ID for the record just created. |
- Events define when the rule should run, such as when a button is clicked, or when the form loads. (Events are optional, you can define "event-less" rules that you can call from other rules.)
- Conditions define whether the rule should run. If the criteria are true, continue the rule, and if the criteria are not met, stop the rule. For example, a condition might evaluate a form to confirm that required fields have content. (Conditions are optional - not all rules will require conditions.)
- Actions define what the rule should do. For example, show a message, start a workflow, or enable a form field. Rules can contain multiple actions that are run in sequence or in parallel.
View
Follow the steps below to configure the send email action. This example uses a view called Student Registration Item based on a SmartObject called Students. The view contains a button called Create Button. Someone clicks the button to create a new student record in the Students SmartObject and send a confirmation email.
- Edit the Student Registration Item view and open the Rules page. Edit the When Create Button is Clicked rule.
- With the Actions tab active, navigate to the Notifications group and click Send an e-mail to add it to the rule definition pane. Click (configure).
- First, configure the From value. Drag the Context Browser > Environment Fields > Mail Server > From Address property into the From text box. There are some limitations to the From value you can use. See Considerations for more information on the From Address property.
- You want the email sent to the address entered on the view. Since this address is different for each student that registers, use a property from the Context Browser as a variable. At runtime, the variable is replaced by the actual email value entered in the view. Drag the Context Browser > Student Registration Item (view) > Controls > Student Email Text Box property into the To text box.
- For the Subject line, enter
Student Registration. - Next, enter content into the email's message body, then use a property from the Context Browser to personalize it. In this case, you are adding a variable for the new student's ID. Begin by entering the following in the message body text area:
Your student registration is complete. Your student ID is:
Thank you for registering!
Drag the Context Browser > Student Registration Item > Students (SmartObject) > ID property to the end of the first line. (Recall that clicking the create button on the view executes a rule that first creates a new record in the Students SmartObject. You are using the ID of this record as the student ID. That is why you use the SmartObject ID as the variable, since the record is created in the SmartObject.) Click OK to save the email configuration. Click OK to save the rule action and exit the rule designer. Click Finish to save and exit the view. - To test the rule, open the view using the Runtime URL found in the central pane. Enter your name and email address. Do not enter a value for the Student ID. Remember that K2 uses the SmartObject ID as the Student ID, so, you don't need to set this value. Click the Create Button, then review the email you receive. Notice the From Address reflects the system value from the K2 mail server and the ID reflects the SmartObject record for this submittal. In the image below, the Student Registration Item view is contained in a form, Student Registration Form. Your screen may not match the image exactly, however your testing results should be the same. If you see an access denied error after clicking the Runtime URL, see the Considerations section for more information on working around this error.
There are two sections to the Send an E-mail configuration screen: E-mail configuration and Context Browser.
In the E-mail section, you configure email properties such as the from address, recipients, subject line, attachments, and message body. The Context Browser contains references, variables, functions, and SmartObject properties. At runtime, K2 replaces references and variables with live data. In this way, you can personalize your content at runtime.
You are on the Send an E-mail screen. The image and table below provide a summary of each property on this screen.
Property | Notes |
---|---|
From | This is the email address used by the K2 mail server to send emails on your behalf. Drag the Context Browser > Environmental Server > Mail Server > From Address property into the From text box. (If this value is already set by default, do not change it.) This field is required. |
To | This is the email address for the people you want to send the email to. If you have more than one email address, separate them with a comma. You can use values from the Context Browser or manually enter email addresses. |
CC | Use this field to send a carbon copy of the email. You can use a value from the Context Browser or manually enter an email address. |
BCC | Use this field to send a blind carbon copy of the email. You can use a value from the Context Browser or manually enter an email address. |
Attachment | Use values from the Context Browser such as a file or image property from a control or SmartObject to add attachments to your email. |
Subject | Use the subject line as a title for your email content. You can use properties from the Context Browser to personalize your message. This field is required. |
Body | Use the message body for your email content. You can use properties from the Context Browser to personalize your message. |
-
For testing purposes, you can run the view using the Runtime URL. If you see an access denied error, one possible reason is the Allow Standalone setting found in the view's Properties pane. If unchecked, the view is not accessible from a browser. In this case, either check the option and rerun the view, or contain the view within a form and run the form.
- In a cloud environment, you cannot change the value of the From Address system property as emails are sent from a K2-controlled server and not your own Exchange server. Use the From Address to configure the From value for sending emails. In a on-premises environment, you may have some control over the address used to send emails. Contact your K2 administrator if you need to use an email address that is different from system email address used in the From Address configuration.
- When adding email addresses to the Send an Email action, ensure you do not add spaces after an email address or between multiple email addresses.