This translation is older than the original page and might be outdated. See what has changed.
Translations of this page:
 

This is an old revision of the document!


Table of Contents

mailSend()

void mailSend(string email, int mailingID, [int time], [string link], [string C1, string C2, string C3, string C4, string C5])

The mailSend() function sends the mailing with the mailingID ID to a specified email address straightaway or at a defined point in time. The email address does not have to – in contrast to the mailResume() and mailSchedule() functions – be known in the project's address list beforehand.

  • email
    Email address where the email should be sent to
  • mailingID
    Numerical ID of the mailing to be sent
  • time (optional)
    Either the delay until the mailing is sent (in seconds, maximum 153900000) or a Unix timestamp that defines the time when it should next be sent.
  • link (optional)
    URL used for the %link% placeholder in the mailing. If no URL is specified, the URL to the Questionnaire is used without further specification of a questionnaire.
  • C1 to C5 (optional)
    If you have specified text here (optional), you can use this text in the mailing with the help of placeholders %custom1% to %custom5%. When used with value(), you can, for example, display responses from the ongoing interview in the email.

Tips

  • A specific mailing can only be sent to a specific email address once per interview with the mailSend() function.
  • A maximum of 20 emails can be sent during an interview using mailSend().

Example

A colleague's email address should be requested in the interview, but not be saved. An invitation should be sent to this email address with a reference to the current interview (case number CASE).

In order to get the email address, an HTML input field is put on page 5 in the questionnaire.

<div>
  Colleague's email address:
  <input type="text" name="email_colleague" style="width: 160px" />
</div>

On the next page in the questionnaire (no later!), the specified email address is read using readGET() and the mailing with the ID 2 will be sent to this email address. The current case number is attached in the URL to the questionnaire as a reference.

$email = readGET('email_colleague', false);
if (trim($email) !== '') {
  $link = 'https://www.soscisurvey.de/PROJEKT/?r='.caseNumber();
  mailSend($email, 2, 0, $link);
}
en/create/functions/mailsend.1429434697.txt.gz · Last modified: 19.04.2015 11:11 by alexander.ritter
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki