diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index 8345167..18ebda0 100755 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -1209,7 +1209,14 @@ class AppController extends Controller if (filter_var($mail, FILTER_VALIDATE_EMAIL)) { $email = new Email(); $etiquetteFrom = explode("@", $config->sender_mail); - $email->attachments(["/var/www/html/labinvent/webroot/img/photos/$nomImg"]); + + // (EP) Je vais tuer le stagiaire qui a fait ça : + //$email->attachments(["/var/www/html/labinvent/webroot/img/photos/$nomImg"]); + // Il fallait plutot faire ça : + $wwwroot_dir = new \Cake\Filesystem\Folder(WWW_ROOT); + $absFileName = new \Cake\Filesystem\File($wwwroot_dir->pwd() . DS . 'img' . DS . 'photos' . DS . $nomImg); + $email->attachments([$absFileName]); + $email->transport('default') ->from([ $config->sender_mail => $etiquetteFrom[0] @@ -1228,7 +1235,14 @@ class AppController extends Controller if (filter_var($mail, FILTER_VALIDATE_EMAIL)) { $email = new Email(); $etiquetteFrom = explode("@", $config->sender_mail); - $email->attachments(["/var/www/html/labinvent/webroot/files/$nomDoc"]); + + // (EP) Je vais tuer le stagiaire qui a fait ça : + //$email->attachments(["/var/www/html/labinvent/webroot/files/$nomDoc"]); + // Il fallait plutot faire ça : + $wwwroot_dir = new \Cake\Filesystem\Folder(WWW_ROOT); + $absFileName = new \Cake\Filesystem\File($wwwroot_dir->pwd() . DS . 'files' . DS . $nomDoc); + $email->attachments([$absFileName]); + $email->transport('default') ->from([ $config->sender_mail => $etiquetteFrom[0] -- libgit2 0.21.2