Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:create:functions:mailschedule [12.09.2015 14:27]
admin [mailSchedule()]
en:create:functions:mailschedule [26.09.2020 14:03] (current)
sophia.schauer
Line 1: Line 1:
 ====== mailSchedule() ====== ====== mailSchedule() ======
  
-''void **mailSchedule**(string //personID//, int //mailing//, int //time//)''+''void **mailSchedule**(string //personID//, int //mailing//, int //time//, [array //settings//])''
  
 This function prepares the sending of a mailing directly in the questionnaire -- for example, the invitation to the second questionnaire. In contrast to ''[[:en:create:functions:mailresume|mailResume()]]'', the current interview will not be resumed. Instead, the mailing is sent in the same way as if it had been prepared manually. This function prepares the sending of a mailing directly in the questionnaire -- for example, the invitation to the second questionnaire. In contrast to ''[[:en:create:functions:mailresume|mailResume()]]'', the current interview will not be resumed. Instead, the mailing is sent in the same way as if it had been prepared manually.
Line 10: Line 10:
   * //mailing//\\ (Numerical) ID of the mailing which should be sent to the participant.   * //mailing//\\ (Numerical) ID of the mailing which should be sent to the participant.
   * //time//\\ Either the delay in email delivery (in seconds: maximum 153900000) __or__ a Unix timestamp, which defines the time until the next email is sent.   * //time//\\ Either the delay in email delivery (in seconds: maximum 153900000) __or__ a Unix timestamp, which defines the time until the next email is sent.
 +  * //settings//\\ Optional settings, specified as associative array with the following keys:
 +    * '''status'''\\ Send reminder/follow-up emails only if the link in the original serial mail ...
 +      * '''finished''' -- ...opened and the questionnaire was filled out to the end
 +      * '''incomplete''' -- ...was not opened or not filled in to the end
 +      * '''no-response''' -- ...was not opened
 +    * '''expire'''\\ Limit the validity of the personal participation link, the same format as for the //time//
 +    * '''to.email'''\\ Do not send e-mail to the e-mail address stored in the address entry, but to the e-mail address specified here. This function can be used to notify the project manager if a respondent does not complete a (follow-up) questionnaire within a defined time.
 +    * '''to.mobile'''\\ Do not send SMS to the phone number (possibly) stored in the address entry, but to the phone number specified here. The phone number must be specified with country code.
 +    * '''%custom1%''' to '''%custom5%'''\\ If contents for user-defined fields are specified in the ''mailSchedule()'' -command, in the serial mail  these contents are used instead of the address entry.
    
 **Note:** A mailing is sent (in contrast to ''mailResume()'') only once per recipient, even if the function is called up repeatedly. Sending different mailings is possible -- e.g. an invitation to take part in the second wave of the survey in 14 days and a further invitation to the third wave in 1 month. **Note:** A mailing is sent (in contrast to ''mailResume()'') only once per recipient, even if the function is called up repeatedly. Sending different mailings is possible -- e.g. an invitation to take part in the second wave of the survey in 14 days and a further invitation to the third wave in 1 month.
Line 15: Line 24:
 **Tip:** There are numerous websites on the internet that can covert a date into a Unix timestamp. For example: [[http://www.unixtime.de/|unixtime.de]]. The PHP [[http://www.php.net/manual/en/ref.datetime.php|Date/Time Functions]] (in particular ''[[http://php.net/manual/en/function.mktime.php|mktime()]]'' and ''[[http://www.php.net/manual/en/function.strtotime.php|strtotime()]]'') are ideally suited to this purpose.  **Tip:** There are numerous websites on the internet that can covert a date into a Unix timestamp. For example: [[http://www.unixtime.de/|unixtime.de]]. The PHP [[http://www.php.net/manual/en/ref.datetime.php|Date/Time Functions]] (in particular ''[[http://php.net/manual/en/function.mktime.php|mktime()]]'' and ''[[http://www.php.net/manual/en/function.strtotime.php|strtotime()]]'') are ideally suited to this purpose. 
  
-===== Example =====+===== Invitation to Follow-Up Survey =====
  
 A participant was invited to take part in the questionnaire via a mailing. 14 days after he clicked on the link, and thus accessed the questionnaire, he should receive an invitation to the second questionnaire (mailing no. 2) A participant was invited to take part in the questionnaire via a mailing. 14 days after he clicked on the link, and thus accessed the questionnaire, he should receive an invitation to the second questionnaire (mailing no. 2)
Line 28: Line 37:
 mailSchedule(false, 2, 1209600); mailSchedule(false, 2, 1209600);
 </code> </code>
 +
 +===== Reminder E-Mails =====
 +
 +The respondent is invited to the first questionnaire (wave 1) with serial mail 1 -- the invitations are staggered so that a-priori it is not known when the respondent will complete the questionnaire. One month after completing the first questionnaire, the respondent should receive an invitation to the second wave of the survey (serial mail 2). If the respondent does not participate, a reminder (serial mail 3) should be sent after one week.
 +
 +In Serial Mail 3 it is set to be a reminder/follow-up mail for Serial Mail 2.
 +
 +The following PHP code is used in the questionnaire for the first survey wave:
 +
 +<code php>
 +mailSchedule(false, 2, strtotime('+1 month'));
 +mailSchedule(false, 3, strtotime('+1 month +1 week'), [
 +  'status' => 'no-response'
 +]);
 +</code>
 +
 +
 +===== Custom Fields =====
 +
 +The following command sends the serial mail with the ID 2 on the next Monday at 8 o'clock to the person, who just completes the questionnaire. Instead of the placeholder ''%custom1%'' the serial mail shows the date when ''mailSchedule()'' was called.
 +
 +<code php>
 +mailSchedule(false, 2, strtotime('next Monday 08:00:00'), [
 +  '%custom1%' => date('d.m.Y')
 +])
 +</code>
 +
en/create/functions/mailschedule.1442060874.txt.gz · Last modified: 12.09.2015 14:27 by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki