Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
This page is for application designers who want to send notifications via email.
Contents
Overview
Emails are sent using
Table of Contents | ||
---|---|---|
|
Overview
To send email notifications to application users, configure a File Exporter which . This allows you to email information about data in PhixFlow and optionally to add a file as an attachment.
Email Accounts Setup
In order to send an email from emails, PhixFlow you must setup have an Email Account to send the emails from.
In the Repository, navigatefrom which to send emails. Email accounts are configured for the whole PhixFlow instance rather than in an application. This means you need administrator privileges to create an account.
Step 1 Create an Email Account
If there is no PhixFlow email account, ask your PhixFlow administrator to create one. If you are using a PhixFlow hosted instance, email support@phixflow.com. Also ask for permission to edit the account.
Step 2 Configure the Email Account
- In the repository, go to Full Repository → Email Accounts
- If you have an account setup double click on it and the following screen will open:
- .
- Double-click the account name to open its properties.
- Make a note of the Login name .
- If do not have an email account that can be used to send notifications:
- Contact your IT Team to setup an account that can be used to send notifications.
- If you are using a PhixFlow hosted instance contact PhixFlow support to set this up for you.
- Now, enter the email account details as detailed in Email Account.
Testing the Account
To test the email account you wish to use:
- Open the Email Account in PhixFlow.
- Enter your email address in the Test To: box.
- From the more menu at the top of the properties, click as you will need to know it when testing.
- Configure the email account as required; see Email Account properties for details of the options. Set
- Outbound: tick
- Enabled: tick
- Save your changes.
Step 3 Test the Email Account
- Reopen the email account.
- In Test To enter your email address.
If the Test To option is not visible, make sure Outbound is ticked. - In the properties toolbar, click
and selectInsert excerpt _more_options _more_options nopanel true
.Insert excerpt _emailConfiguration _emailConfiguration nopanel true - PhixFlow sends an email to the address specified in Test to.
- You should now receive Check your email. There should be an email address from the emal account's Login address setup on your Email Account. For , for example
notifications@phixflow.com
.
Sending an Email
You may want to add an attachment to an email.
In this example, we will send an email with an attachment that contains a list of processed employees for a particular day. This data is available from the downloads section of our
Tip |
---|
You can download the example data from the PhixFlow Learning Centre. |
Step 1 Create an Analysis Model to Generate the Attachment
- Create an analysis model or open one that contains the required data; see Analysis Models and Exporting to a File.
- Add a the table which that contains the data you wish to export as an attachment.Note in this example I have created a second table,
Send Email
, that is used only to send the email and will not affect the static Employees table that imports the data. Separating the data like this gives us want to export. Hover your mouse pointer over the table and in the popup toolbar, click
. This means the data remains unaffected when you run the analysis model.Insert excerpt _static _static nopanel true - Add a second table called Send Email. This separates the data from generating the email, which gives you more control over the different tasks.
- From the Toolbar analysis model toolbar drag in a
onto the canvas.Insert excerpt _file_exporter _file_exporter nopanel true - Connect the Table table Employees to the File Exporterfile exporter. This pipe will be used to run the File Exporter laterfile exporter when you run analysis.
- Connect the Table to the File Exporter table Employees to the file exporter a second time. This will be used to count the records later.In the pipe properties which open for the second connectionPhixFlow opens the pipe properties.
- To configure the second pipe to count the records, set:
- Name
- :
recs
. - Type
- : select Look-up.
- Save your changes.
Your
- model should look
- like this.
Step 2 Configure the File Exporter
- In the analysis model, click on the
to open its properties:.Insert excerpt _file_exporter _file_exporter nopanel true - In Basic Settings, set:
- Name
- : to indicate the purpose of the email
- .
- Enabled
- : ticked.
Leave this unticked during testing to avoid generating lots of data and emails then tick it when you are ready for the file to be exported and emails to be sent.- File Name
- : specify the name
- for the exported file
- . The file extension
- must match the type of data being exported.
- For a simple
- name, enter text in quotes, for example:
"Employees.xlsx"
- name, enter text in quotes, for example:
- For
- a dynamically generated name, enter an expression that returnd a string; see Expressions and PhixScripts. For example:
"Employees_"+today()+".xlsx"
- a dynamically generated name, enter an expression that returnd a string; see Expressions and PhixScripts. For example:
- generates the name Employees_20220831.xlsx.
- Output Directory
- : enter an expression to specify where PhixFlow saves the file in the export directory on the server, unless Ignore Base Directory is ticked
- ; see File Exporter
- for details.
- Export File as
- : select the
- file type for the exported file.
For this example we are using Excel Spreadsheet. - Overwrite existing file
- : optionally tick to overwrite files that have the same name
- ,
for example to have only one Employees.xlsx file on the server at any one time. - Header
- : optionally tick to include column headers in the output file.
- In Input Multiplier set:
- Input Multiplier: enter an expression that evaluates to a list of one or more values. For each value in the list, the internal variable, _inputMultiplier, will be set to that value
- . See Internal Variables.
For this example, we want to count the records in the recs pipe
- , so enter:
if(countElements(recs) > 0, countElements(recs), 0)
- In Send by Email set:
- Email From
- : enter the email address set in
- the email account → Login. For example,
notifications@phixflow.com
- Subject Expression
- : enter an expression to generate the subject line of the email, for example,
"RE: Employee Records "+today()
- Attach File,
- tick to attach the
- exported file to the email.
Alternatively, leave this unticked if you
- want the email to include a link to the exported file.
- Message Expression
- : enter an expression to generate the message. For example, the following incorporates the value from the Input Multiplier to create a message that tells the recipient how many records were processed:
"We have processed "+_inputMultiplier.1+" employee records today."
.
- → Recipient Expressions
- → TO Expression,
- enter an expression
- that contains the email addresses of the recipients
- . For example
- a single address like
"info@phixflow.com"
.
- Save you changes. Save you
Here is a screenshot of the input multiplier and file exporter configuration- Save your changes to the file exporter and to the analysis model.
Step 3 Run Analysis
- To run analysis on the table that is set to call calls the file exporter to , right-click and select
to test it works. For example, inInsert excerpt _run_analysis _run_analysis nopanel true
In our example this table is is called Send Email.
Here is an example screenshot of this configuration:
Step 4 Set up the Actionflow
- From the application home screen click on Screens.
- Open the screen that from which you want to send the email from or create a new screen to send the email. See Designing ; see Screens.Add
- From the Serene Grey palette, drag in a Button to the screen that will be used to call the email. These are available from the palette.send the email.
- Right-click on the button and select Add Actionflow. Give the actionflow a meaningful name, for example:
Send Email Notification
. - In the actoinflow Actionflow that opens, click on Connection, and select On Click.
- From the toolbar, drag an Analysis Task an analysis node onto the Canvas.Provide a meaningful canvas and give it a name.
- From In the table section toolbar click
, from the pane that opens drag the Table we created earlier to call the file exporter into the Analysis Task → List. From the list of tables, drag the table that calls the file exporter onto the analysis node.Insert excerpt _tableOnly _tableOnly nopanel true - Save your changes to the actionflow.
- Connect To connect the On Click input to the Analysis Task by dragging analysis node, drag a line between the two. See Wiring Actionflows. ; see Mappings and Connectors.
- Save your changes.
The button is now
setconfigured to run
the Analysis Task that will result in the email being sent.Testing the Resultsan actionflow, which:
- runs an analysis on the model
- to generate a data file
- attach the file to an email
- and sends the email to the recipient.
Step 5 Testing the Configuration
- Run analysis on the table that drives the file exporter that sends the email.
- Open the
Insert excerpt _console _console nopanel true - In the Completed Tasks section, click on the Run Analysis Task you ran in the previous step.
- In the Messages for this completed task click on the Emails tab.
If it is not visible you may need to click on the more menu to see the option. - In the Status column, one Check the Status column. It can take a few minutes for an email to be sent and sometimes longer if the attached file is large.
One of the following common statuses will be set:- Ready, the email is produced
- Incomplete, PhixFlow is trying to send the email.
Test your email account is working correctly. - Sent, the email has been successfully sent.
- It can take a few minutes for an email to be sent and sometimes longer if the attached file is large.
- If the status stays as Incomplete, test your Email Account setup above is working correctly.
- The Files tab shows any Check the Files tab for details of the files produced as part of this completed task.
This is useful to see if the file exporter ran but the email portion has failed. - If you email has not been received do not receive the email,
- check your email client's Junk folder
- check the log for
- errors
- .
Sending an Email Incorporating Table Data
Following the example above we will now setup an example where an email will be sent to any employee that has a missing telephone number. To achieve this we will perform The following example shows you how to configure PhixFlow to email employee with no telephone number in their record. To identify these employees, we run a lookup that only returns the employee records without a telephone number, however you can easily amend this setup to suit your needs:
Create an Analysis Model.
You can adapt the steps by using a lookup that provides the email addressees that you require.
- Create an analysis model or open one that contains the required table.
- From the Toolbar toolbar, drag a
onto the canvas.Insert excerpt _file_exporter _file_exporter nopanel true - Connect the Table which contains the desired data to the File Exporter.Connect the Table which contains the desired data to the File Exporter, a table to the file exporter, and then connect them a second time.
- In the pipe properties which that open, set:
- Name
- :
recs
. - Type
- : select Look-up.
- Filter
- : set the filter criteria for the lookup,
- to return
- only the data you need.
In this example, the filter allows only
- records where Telephone is null, as illustrated
- below:
- Save your changes to the pipe.
The setup analysis model is similar to our previous example but with the addition of a filter on the lookup pipe, as illustrated here: - The setup for the
is the same as the Sending an Email example above, with the following changes:Insert excerpt _file_exporter _file_exporter nopanel true - Attach File: unticked as we do not want users to receive a file
unticked
- .
- Input Multiplier
- : the expression evaluates to the list of records
- from the lookup pipe. In our example the lookup pipe is called mtn so we set the _inputMultiplier to:
mtn
- Send HTML
- : tick
- to send our contacts a HTML email.
Message Expression
: as Send HTML is ticked, the message box is treated as
a HTML field. This means you can use HTML markup
. In our example we want to send a personalised message to the user with their first name
and a link to login to PhixFlow
.
Code Block firstline 1 title PhixFlow HTML Message linenumbers true do( "<p>Hi " + mtn.FirstName + ",</p>"+ "<p>Please login to PhixFlow and update your number.</p>"+ "<a href='https://
phixflow.com/
PhixFlow/start.html?application=
MyApplication'>PhixFlow Login</a>" )
Save
Youryour changes.
Run analysis on the table set to call that calls the file exporter to test it works. For example, in In our example this table is called Send Email Requests.
We can now
When you know the configuration works, connect the
tablebutton to an
button andactionflow as
outlinedexplained in the Sending an Email
example aboveabove.
Learn More
Send Emails with Excel Template
See Excel Template.
More Information
For more information on the file exporter and a full list of email options see, File Exporter.
For more information on expressions and using them in expression fields see, Expressions and PhixScripts- Excel Template: for how to control which values from which input pipes are written to an Excel file.
- File Exporter: for details of properties and email options
- Expressions and PhixScripts for help on how to write expressions.