How to automatically send an email to you or your research team

From Lifeguide Wiki
Jump to navigation Jump to search

Please see the section on How to automatically send an email to the users of your intervention for some background information on sending emails which will help you with this section.

You can send an email to a researcher, or other fixed person, relating to each end-user (e.g. if you need to send an e-mail each time an end-user finishes a session) or if an e-mail needs to be sent out each time an end-user responds to an interaction in a certain way (e.g. if their responses indicate that a health condition is getting worse).

To do this, you will need to use the append command to attach the end-user's username onto the unique name you have given to the e-mail message because the researcher has a constant email address, so if three end-users all reach the same point in the intervention, three e-mails will need to be sent to the researcher, but the email name and email address combination will be the same in each case. By using the append command, you will then have a unique name for each e-mail.

So, in the example below, the participant's username has been appended to the string "s1complete" to create a unique name for each of the emails that will be sent to the researcher account when a participant has completed session 1:

sendemail(append(username,"s1complete"), "studyemail@mail.ac.uk", "Participant has completed session 1", "A participant has completed the first session in the study", 10)

If you want to put the participant's ID number in the email so you know which participant has completed session 1, you can add this as follows:

sendemail(append(username,"s1complete"), "studyemail@mail.ac.uk", "Participant has completed session 1", append("Participant ", loadvalue (username, "idnumber"), " ", "has completed session 1.\nPlease arrange a time to call them"), 10)

In the above example, the quotation marks ("" "") have been used to represent a space between the ID number and the text has completed session 1. \n has been used to create a new line. Each participants ID number has been saved previously in the logic file as "idnumber" and has been loaded here so it can appear in the content of the email.