README.md 4.26 KB
Newer Older
1
# Send token email via PHP Cli
Denis Chenu's avatar
Denis Chenu committed
2
Allow to send token email (invite or reminder) via PHP cli . This allow to use crontab or Scheduled task to send email.
3 4 5

## Installation

6 7
- This plugin is only tested with LimeSurvey 2.06. Tested on 2.50 build (always use latest build if possible)
- In some LimeSurvey version : you need to manually create the `./application/runtime` to use CFileLogRoute ([See LimeSurvey manual](https://manual.limesurvey.org/Cron)).
8 9

### Via GIT
10
- Go to your LimeSurvey Directory (version up to 2.06, build 150729)
11 12
- Clone in plugins/sendMailCron directory

13 14 15 16 17
### Via ZIP dowload
- Get the file at http://extensions.sondages.pro/IMG/auto/sendMailCron.zip
- Extract : `unzip sendMailCron.zip`
- Move the directory to plugins/ directory inside LimeSUrvey

18 19 20 21 22
## Usage

- When activated the plugin settings are updated to use the actual url for email. This can be updated at any time
- You can choose
  - Max number of email to send
23
  - Batch size on each command
24 25
  - Minimum delay between invitation and first reminder
  - Minimum delay between each reminders
26
  - Same and more in each surveys setting
27
  - If plugin validate the email (this allow only one email by token)
28
  - The cron type list to be allowed in survey settings
Denis Chenu's avatar
Denis Chenu committed
29
- To test the plugin you need to call it via PHP Cli `php yourlimesurveydir/application/commands/console.php plugin cron --interval=1` (remind: it send email in this way)
30
- This line can be added in your crontab or Task Scheduler
31

32 33
### Params

34
The plugin accept optionnal parameters in the command line
35

36 37 38
- **debug** level from 0 : nothing is shown except errors to 3 all action are shown sendMailCronDebug=3 (integer, default 1)
- **simulate** action done by the plugin : don't send any email or update token : sendMailCronSimulate=1 (boolean, default false)
- **disable** all action done by the plugin in command line : sendMailCronDisable=1 (boolean, default false)
39
- **cronType** of actual task : sendMailCronType=test (string|null, default null)
40 41 42

Some example

Denis Chenu's avatar
Denis Chenu committed
43 44
- `php yourlimesurveydir/application/commands/console.php plugin cron sendMailCronDebug=0` nothing is printed to screen except errors. By default show tested survey and action, and number of email send for each survey
- `php yourlimesurveydir/application/commands/console.php plugin cron sendMailCronDebug=3 sendMailCronSimulate=1` just to see what happen before put the command in the crontab, with all the trace of the plugin
45

46 47 48 49
### Logging
Plugin use 2 system for logging :
- echo at console what happen : then you can use cron system to send an email, or test the plugin : error and info was echoed
- use [Yii::log](http://www.yiiframework.com/doc/guide/1.1/en/topics.logging) : 3 state : error, info and trace. Loggued as application.plugins.sendMailCron
50
  - The log file is, by default ./tmp/runtime/application.log or ./application/runtime/application.log before LimeSurvey version 2.57.2
Denis Chenu's avatar
Denis Chenu committed
51 52 53
  - To have more information on mail error : you must enable 'SMTP debug mode' in LimeSurvey instance global settings

#### Exemple of logging system:
Denis Chenu's avatar
Denis Chenu committed
54

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
  ````
      'log' => array(
          'routes' => array(
              'fileError' => array(
                  'class' => 'CFileLogRoute',
                  'levels' => 'warning, error',
              ),
              'sendMailCron' => array(
                  'class' => 'CFileLogRoute',
                  'levels' => 'info, warning, error',
                  'categories'=>'application.plugins.sendMailCron',
              ),
          )
      ),
  ````
Denis Chenu's avatar
Denis Chenu committed
70

71 72 73 74 75
## Contribute

Issue and merge request are welcome on [framagit](https://framagit.org/SondagePro-LimeSurvey-plugin/sendMailCron) or [github](https://github.com/SondagesPro/LS-sendMailCron/).

Translation can be done via [Glotpress of Sondages Pro plugin](http://translate.sondages.pro/projects/sendmailcron)
76

77 78

## Home page & Copyright
79
- HomePage <http://extensions.sondages.pro/sendmailcron/>
80
- Copyright © 2016-2017 Denis Chenu <http://sondages.pro>
81
- Copyright © 2016 AXA Insurance (Gulf) B.S.C. <http://www.axa-gulf.com>
82
- Copyright © 2016-2017 Extract Recherche Marketing <http://www.extractmarketing.com>
83
- Licence : GNU Affero General Public License <https://www.gnu.org/licenses/gpl-3.0.html>
84 85 86 87

## Support
- Issues <https://git.framasoft.org/SondagePro-LimeSurvey-plugin/sendMailCron>
- Professional support <http://extensions.sondages.pro/1>