/var/spool/
root@MaarchIntegration1904:/var/spool/mail# ls -ltr
total 4
-rw------- 1 root mail 0 sept. 25 2018 root
-rw------- 1 mail mail 1888 sept. 25 2018 maarch
contexte
notif_email_stack (table vider les dates creation date et send date) email
maarch@MaarchIntegration1810:/var/www/html/MaarchCourrier/custom/cs_test/modules/notifications/batch/config$ ls -ltr
total 4
-rwxrwx--- 1 maarch maarch 2824 juil. 11 17:41 config.xml
maarch@MaarchIntegration1810:/var/www/html/MaarchCourrier/custom/cs_test/modules/sendmail/batch/config/config.xml$ ls -ltr
total 4
-rwxrwx--- 1 maarch maarch 2824 juil. 11 17:41 config.xml
https://docs.maarch.org/gitbook/html/MaarchCourrier/18.04/guat/guat_exploitation/sendmail_notif.html
<MAILER>
<path_to_mailer>/apps/maarch_entreprise/tools/mails/htmlMimeMail.php</path_to_mailer>
<path_to_phpmailer>PHPMailer_v5.1</path_to_phpmailer>
<type>mail</type><!-- mail (default), smtp, sendmail, qmail -->
<smtp_host>ssl://smtp.gmail.com</smtp_host><!-- smtp1.example.com:25;smtp2.example.com -->
<smtp_port>465</smtp_port><!-- smtp1.example.com:25;smtp2.example.com -->
<smtp_user>ines.mkacher@maarch.org</smtp_user>
<smtp_password>$$$$$$$$$</smtp_password>
<smtp_auth>true</smtp_auth>
<smtp_secure>ssl</smtp_secure><!-- tls ou ssl -->
<charset>utf-8</charset><!-- Default : iso-8859-1 -->
<domains>gmail.com</domains><!-- Rewrite Recipient with config->adminmail if mailfrom and mailto is out of the domains -->
<x-mailer/><!-- Rewrite X-Mailer header, default : PHP/[phpversion] -->
<mailfrom></mailfrom>
</MAILER>
<MAILER>
<path_to_mailer>/apps/maarch_entreprise/tools/mails/htmlMimeMail.php</path_to_mailer>
<path_to_phpmailer>PHPMailer_v5.1</path_to_phpmailer>
<type>smtp</type><!-- mail (default), smtp, sendmail, qmail -->
<smtp_host>ssl://smtp.gmail.com</smtp_host><!-- smtp1.example.com:25;smtp2.example.com -->
<smtp_port>465</smtp_port><!-- smtp1.example.com:25;smtp2.example.com -->
<smtp_user>ines.mkacher@maarch.org</smtp_user>
<smtp_password>$$$$$$$$$</smtp_password>
<smtp_auth>true</smtp_auth>
<smtp_secure>ssl</smtp_secure><!-- tls ou ssl -->
<charset>utf-8</charset><!-- Default : iso-8859-1 -->
<domains>gmail.com</domains><!-- Rewrite Recipient with config->adminmail if mailfrom and mailto is out of the domains -->
<x-mailer/><!-- Rewrite X-Mailer header, default : PHP/[phpversion] -->
<mailfrom></mailfrom>
si le lien dans le mail de notification reçu n'est pas le bon verifiez la ligne
<MaarchUrl>*********</MaarchUrl>
dans le fichier /var/www/html/MaarchCourrier/custom/cs_test/modules/notifications/batch/config/config.xml
verifiez que la ligne custom_id est bien renseignée
<customID>cs_test/customID>
/var/www/html/MaarchCourrier/custom/cs_test/modules/notifications/batch/config# cat config.xml
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
<!-- le nom du fichier doit etre config.xml ou config_{custom_id}.xml -->
<CONFIG>
<Lang>fr</Lang> <!-- fr, en-->
<MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory>
<customID>cs_test/customID>
<MaarchUrl>IP_SERVEUR/cs_test/</MaarchUrl>
<MaarchApps>maarch_entreprise</MaarchApps>
<TmpDirectory>/var/www/html/MaarchCourrier/modules/notifications/batch/tmp/</TmpDirectory>
<debugmode>
<dontflag_mail>true</dontflag_mail>
<verbose_mode>false</verbose_mode>
<simulate_sendmail>false</simulate_sendmail>
</debugmode>
<maxsize>5</maxsize> <!--In Mo: Taille maximum pour envoyer le courrier en pièce jointe afin d’éviter les erreurs du serveur mail-->
<maxitem>90</maxitem> <!-- Nombre de pièce jointe maximum à envoyer si transfert en pièce jointe-->
</CONFIG>
Dans le cas de non reception de mail, on peut faire le test en lançant le script d'envoi de mail :
/var/www/html/MaarchCourrier/custom/cs_carrieres/modules/notifications/batch/scripts$ ./sendmail.sh
Vérification des droits
~/web/MaarchCourrier/custom/cs_test/modules/notifications/batch/scripts$ ls -ltr
total 20
-rwxr-xr-x 1 localeo localeo 334 Aug 13 15:30 sendmail.sh
-rwxr-xr-x 1 localeo localeo 400 Oct 11 15:04 BASKET.sh
-rwxr-xr-x 1 localeo localeo 400 Oct 11 18:42 notification_cs_1267_BASKETS.sh
-rwxr-xr-x 1 localeo localeo 397 Oct 11 18:55 notification_cs_1267_NCT.sh
-rwxr-xr-x 1 localeo localeo 901 Oct 11 19:01 nct-ncc-and-anc.sh
maarch@MaarchIntegration1810:/var/www/html/MaarchCourrier/modules/notifications/batch/logs/process_email_stack$ ls -ltr
total 4
-rw-r--r-- 1 maarch www-data 484 août 6 10:56 2019-08-06_10-55-26.log
maarch@MaarchIntegration1810:/var/www/html/MaarchCourrier/modules/notifications/batch/logs/process_email_stack$ tail -f 2019-08-06_10-55-26.log
[2019-08-06 10:55:26] INFO 0 'Load xml config file:/var/www/html/MaarchCourrier/custom/cs_carrieres/modules/notifications/batch/config/config.xml'
[2019-08-06 10:55:26] INFO 0 'Load xml config file:/var/www/html/MaarchCourrier/custom/cs_carrieres/modules/notifications/batch/config/config.xml'
[2019-08-06 10:55:26] INFO 0 'An instance of the batch is already in progress. Waiting for the second try..'
[2019-08-06 10:56:26] INFO 109 'An instance of the batch is already in progress'
Si la log est inutilement verbeuse avec des notices vous pouvez changer l'élement error_reporting
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
Dans les deux fichiers suivants :
/etc/php/7.0/apache2/php.ini
/etc/php/7.0/cli/php.ini
Ensuite il faudra bien penser à redémarrer Apache :
systemctl restart apache2
ou
service apache2 start
Le message 'An instance of the batch is already in progress' ou 'ERROR 13 'Error persists, please solve this before launching a new batch' peuvent signifier qu'il y a des fichiers .lck qui bloquent l'execution du script :
maarch@MaarchIntegration1810:/var/www/html/MaarchCourrier/modules/notifications/batch$ ls -ltr
total 136
drwxrwx--- 6 maarch www-data 4096 mai 27 15:53 logs
-rw-r--r-- 1 maarch www-data 1 mai 28 10:15 process_event_stack_error.lck
-rw-r--r-- 1 maarch www-data 1 mai 28 10:30 process_email_stack.lck
Supprimer les .lck puis relancer le script
maarch@MaarchIntegration1810:/var/www/html/MaarchCourrier/modules/notifications/batch$ rm *.lck
root@managua:/etc# cat crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
root@managua:/etc/cron.d# ls -ltr
total 16
-rw-r--r-- 1 root root 712 janv. 1 2017 php
-rw-r--r-- 1 root root 396 mai 25 2017 sysstat
-rw-r--r-- 1 root root 740 juin 7 2019 MAARCH
-rw-r--r-- 1 root root 3394 juin 7 2019 maarch_courrier_prod
maarch@maarch-debian:/var/www/html/maarch_courrier/modules/sendmail/batch/logs$ telnet "smtphost" "port"
Trying smtphost...
telnet: Unable to connect to remote host: Connection timed out
Vous avez du nouveau courrier dans /var/mail/maarch
php 'process_email_stack.php' -c /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/notifications/batch/config/config.xml -n BASKETS
maarch@MaarchIntegration1810:/var/www/html/MaarchCourrier/modules/notifications/batch/logs/basket_event_stack$ cat 2019-08-06_11-30-03.log
[2019-08-06 11:30:04] INFO 0 'Load xml config file:/var/www/html/MaarchCourrier/custom/cs_carrieres/modules/notifications/batch/config/config.xml'
[2019-08-06 11:30:04] INFO 0 'Load xml config file:/var/www/html/MaarchCourrier/custom/cs_carrieres/modules/notifications/batch/config/config.xml'
root@vps495398:/var/www/html/maarch_courrier/modules/notifications/batch/logs/process_email_stack# ls -ltr
total 60
-rw-r--r-- 1 maarch maarch 400 Sep 8 12:28 2019-09-08_12-28-07.log
-rw-r--r-- 1 maarch maarch 400 Sep 8 12:30 2019-09-08_12-30-01.log
notification_cs_ines_BASKETS.sh
Erreur affichée lors du lancement du script :
maarch@MaarchIntegration1904:/var/www/html/MaarchCourrier/custom/cs_ines/modules/notifications/batch/scripts$ ./notification_cs_ines_BASKETS.sh
PHP Fatal error: Uncaught Exception: Argument driver is empty in /var/www/html/MaarchCourrier/src/core/models/ValidatorModel.php:28
Stack trace:
#0 /var/www/html/MaarchCourrier/src/core/models/DatabasePDO.php(87): SrcCore\models\ValidatorModel::notEmpty(Array, Array)
#1 /var/www/html/MaarchCourrier/modules/notifications/batch/load_basket_event_stack.php(291): SrcCore\models\DatabasePDO->__construct(Array)
#2 /var/www/html/MaarchCourrier/modules/notifications/batch/basket_event_stack.php(17): include('/var/www/html/M...')
#3 {main}
thrown in /var/www/html/MaarchCourrier/src/core/models/ValidatorModel.php on line 28
Fatal error: Uncaught Exception: Argument driver is empty in /var/www/html/MaarchCourrier/src/core/models/ValidatorModel.php:28
Stack trace:
#0 /var/www/html/MaarchCourrier/src/core/models/DatabasePDO.php(87): SrcCore\models\ValidatorModel::notEmpty(Array, Array)
#1 /var/www/html/MaarchCourrier/modules/notifications/batch/load_basket_event_stack.php(291): SrcCore\models\DatabasePDO->__construct(Array)
#2 /var/www/html/MaarchCourrier/modules/notifications/batch/basket_event_stack.php(17): include('/var/www/html/M...')
#3 {main}
thrown in /var/www/html/MaarchCourrier/src/core/models/ValidatorModel.php on line 28
Correction :
Ajouter le nom du custom (customID) à l'emplacement suivant :
/var/www/html/MaarchCourrier/custom/cs_ines/modules/notifications/batch/config/config.xml
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
<!-- le nom du fichier doit etre config.xml ou config_{custom_id}.xml -->
<CONFIG>
<Lang>fr</Lang> <!-- fr, en-->
<MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory>
<customID>cs_ines</customID>