function sendByMail() { require_once "sendmail.class.php"; $sendmail = new sendMail(); $sendmail->set('html', true); foreach ($this->destinations as $email) { $mensaje['to'] = $email; $mensaje['subject'] = $title; $mensaje['from'] = '*****@*****.**'; $sendmail->getParams($mensaje); $sendmail->setBody(urldecode($content)); $sendmail->setHeaders(); if (!$sendmail->send()) { echo "Error enviando el email.<br />"; } else { echo "Invitación enviada con exito."; } } }
//read the file with the e-mail template $message_file = fopen("configs/newuser.txt","r"); $message = fread($message_file, filesize("configs/newuser.txt")); fclose($message_file); //replace all the needed string with predefined data $message = str_replace('{user_name}',$_POST['login'],$message); $message = str_replace('{access_pass}',$_POST['pass'],$message); $message = str_replace('{station_address}',SRC_ROOT,$message); //create mail $myMailer = new sendMail($_POST['mail'],MAILBOT,$STRING['NEWUSER'],$message); //send mail $myMailer->send(); } //create SADM USER $sdb->query("INSERT INTO authenticate(username,passwd,user_type,general_id,primary_account) VALUES('" . $_POST['login'] . "','" . $_POST['pass'] . "','member','" . SADM_GROUP . "','false' )"); $my_new_id = $sdb->getOne("select auth_id from authenticate where username = '******'login'] . "'"); $sdb->query("INSERT INTO user_preferences(auth_id) values('$my_new_id')"); //create STATION USER $db->query("INSERT INTO user_map(auth_id,access_id,name,mail,role) VALUES('$my_new_id','$_POST[access_level]','$_POST[name]','$_POST[mail]','$_POST[role]')"); //create maildirs //$fp = @fopen("/var/squirrel/maildir-creation/new-maildirs","a+"); //@fputs($fp,"$_POST[login]\n"); //@fclose($fp);
$db->addProbeEvent('ok', '', $server['id']); $logtime = $db->getProbeStatusLogtime($server['id']); // mail it $text = "Service: " . $server['name'] . "\nURL: " . $server['url'] . "\nString: " . $server['findstring'] . "\nState: OK\n\nDate/Time: " . date($timeformat) . "\nSince:" . date($timeformat, strtotime($logtime)) . " (" . round(abs(time() - strtotime($logtime)) / 60, 1) . " minute(s))\n\nAdditional Info: \n\n" . $sTest->getResult(); $status = $db->setProbeStatus($server['id'], 1); // print ("Error: Servertest for probe '" . $sTest->getTitle() ."' failed!\n"); $responsible = $db->getAllResponsible($server['id']); if (isset($responsible)) { foreach ($responsible as $recipient) { // mail it if (strtotime($startquietmode) <= time() && time() <= strtotime($endquietmode)) { echo "not sending mail because of quiet mode\n"; } else { echo "sending mail\n"; $mailer = new sendMail($recipient['email'], $mailfrom, $replyto); $mailer->send("RECOVERY: " . $sTest->getTitle() . " is OK", $text); } } } else { throw new Exception("No responsible person found. Please set up at least one person!"); } } } } } } catch (Exception $ex) { // send mail print "Exception occured for probe '" . $sTest->getTitle() . "': " . $ex->getMessage() . "\n"; } flock($fp, LOCK_UN); // release the lock