fputs($f1, "cd " . __DIR__ . "/files \n"); // var_dump($sql,$Tab); foreach ($Tab as $row) { $author = new User($db); $author->fetch($row->fk_user_author); //var_dump( is_file( 'files/'.$row->uid.'.pdf'), dol_buildpath('/query/files/'.$row->uid.'.pdf') ); if ($step == 1) { $url = dol_buildpath('/query/dashboard.php', 2) . '?action=run&uid=' . $row->uid; //echo $url; fputs($f1, "wkhtmltopdf --orientation Landscape " . escapeshellarg($url) . " " . $row->uid . ".pdf \n"); } elseif ($step == 2 && is_file(dol_buildpath('/query/files/' . $row->uid . '.pdf'))) { $g = new UserGroup($db); if ($g->fetch($row->fk_usergroup) > 0) { $TUser = $g->listUsersForGroup(); foreach ($TUser as &$u) { if ($u->statut == 1) { $mailto = $u->email; if (!empty($mailto)) { print "{$mailto} \n"; $m = new TReponseMail($author->email, $mailto, $langs->trans('Report') . ' : ' . $row->title, $langs->trans('PleaseFindYourReportHasAttachement') . " : " . dol_buildpath('/query/dashboard.php?action=run&id=' . $row->rowid, 2)); $m->add_piece_jointe($row->uid . '.pdf', dol_buildpath('/query/files/' . $row->uid . '.pdf')); $m->send(); } } } } unlink(dol_buildpath('/query/files/' . $row->uid . '.pdf')); // suppresion du pdf après envoi par mail } } fclose($f1);
<?php require '../../../master.inc.php'; require '../inc.core.php'; $mailto = $argv[1] or die('?to='); $r = new TReponseMail('*****@*****.**', $mailto, 'test envoi mail smtp', 'Ceci est un test, merci de ne pas tenir compte'); // $r->use_dolibarr_for_smtp = false; print (int) $r->send();