function send_message($address, $message) { // global $return_msg; global $phpml; global $PHPML_LANG; $rc = false; if ($phpml['EmailSend']) { $mail = new MyMailer(); $mail->Subject = stripslashes('[' . $phpml['ListName'] . '] Mailing List'); $mail->Body = stripslashes($message); $mail->AddAddress($address); if (!$mail->Send()) { $_SESSION['return_msg'] = $PHPML_LANG["error_sending"] . " (" . $address . "): " . $mail->ErrorInfo; } else { $rc = true; } $mail->ClearAddresses(); } return $rc; }
public function restitution_mdp($tab) { if ($tab['categ'] == 'infirmier') { $statement = 'SELECT * FROM INFIRMIER WHERE EMAIL=:email'; } elseif ($tab['categ'] == 'admin') { $statement = 'SELECT * FROM ADMIN WHERE EMAIL=:email'; } elseif ($tab['categ'] == 'patient') { $statement = 'SELECT * FROM PATIENT WHERE EMAIL=:email'; } else { return false; //si le type n'est pas correct on renvoit faux } $sth = $this->connexion->prepare($statement); $sth->bindParam(':email', $tab['email'], PDO::PARAM_STR); if ($sth->execute() && $sth->rowCount() > 0) { $user = $sth->fetchObject(); $statement = 'INSERT INTO JETON (LIEN) VALUES("lien_a_inserer")'; $sth = $this->connexion->prepare($statement); if ($sth->execute() && $sth->rowCount() > 0) { $idjeton = $this->connexion->lastInsertId(); $date = new DateTime(); $date->setTimestamp(time()); $datetime = $date->format('Y-m-d H:i:s'); $jeton = 'utype=' . $tab['categ'] . '&user='******'&jeton=' . $idjeton . '&date=' . $datetime; $jeton_crypte = Cryptage::mc_encrypt($jeton); $lien = 'http://' . $_SERVER['HTTP_HOST'] . '/Liemie/restitution_mdp.php?jeton=' . $jeton_crypte; $hash_jeton = md5($user->EMAIL . '' . $idjeton . '' . $tab['categ'] . '' . $datetime); $statement = 'UPDATE JETON SET LIEN=:lien, DATE_JETON=:date WHERE ID_JETON=:idjeton'; $sth = $this->connexion->prepare($statement); $sth->bindParam(':idjeton', $idjeton, PDO::PARAM_INT); $sth->bindParam(':lien', $hash_jeton, PDO::PARAM_STR); $sth->bindParam(':date', $datetime, PDO::PARAM_STR); if ($sth->execute() && $sth->rowCount() > 0) { $corps = 'Pour récupérer votre mot de passe, veuillez suivre le lien suivant : <a href="' . $lien . '">Réinitialiser le mot de passe</a> !'; $unmail = new MyMailer('*****@*****.**', $user->EMAIL, 'Kaliémie : Récupération de votre mot de passe.', $corps, '*****@*****.**', 'siocarcouet', 'ssl://smtp.gmail.com', 465); if ($unmail->envoyerMail()) { return true; } else { //echo $unmail->getErreur(); } } } } return false; }
require_once dirname(__FILE__) . "/../../library/classes/WSProvider.class.php"; require_once $GLOBALS['srcdir'] . "/classes/postmaster.php"; $alertmsg = ''; $bg_msg = ''; $set_active_msg = 0; $show_message = 0; /* Sending a mail to the admin when the breakglass user is activated only if $GLOBALS['Emergency_Login_email'] is set to 1 */ $bg_count = count($access_group); $mail_id = explode(".", $SMTP_HOST); for ($i = 0; $i < $bg_count; $i++) { if ($_GET['access_group'][$i] == "Emergency Login" && $_GET['active'] == 'on' && $_GET['pre_active'] == 0) { if ($_GET['get_admin_id'] == 1 && $_GET['admin_id'] != "") { $res = sqlStatement("select username from users where id={$_GET["id"]}"); $row = sqlFetchArray($res); $uname = $row['username']; $mail = new MyMailer(); $mail->SetLanguage("en", $GLOBALS['fileroot'] . "/library/"); $mail->From = "admin@" . $mail_id[1] . "." . $mail_id[2]; $mail->FromName = "Administrator OpenEMR"; $text_body = "Hello Security Admin,\n\n The Emergency Login user " . $uname . " was activated at " . date('l jS \\of F Y h:i:s A') . " \n\nThanks,\nAdmin OpenEMR."; $mail->Body = $text_body; $mail->Subject = "Emergency Login User Activated"; $mail->AddAddress($_GET['admin_id']); $mail->Send(); } } } /* To refresh and save variables in mail frame */ if (isset($_POST["privatemode"]) && $_POST["privatemode"] == "user_admin") { if ($_POST["mode"] == "update") { if (isset($_POST["username"])) {
/** * Function to send reminders. * * Function that sends reminders and returns an array with a specific data structure. * <pre>The data structure of the return array includes the following elements * 'total_pre_unsent_reminders' - Number of reminders before processing. * 'total_post_unsent_reminders' - Number of reminders after processing. * 'number_success_emails' - Number of successfully sent email reminders. * 'number_failed_emails' - Number of failed sent email reminders. * 'number_success_calls' - Number of successfully call reminders. * 'number_failed_calls' - Number of failed call reminders. * </pre> * * @return array see above for data structure of returned array */ function send_reminders() { $logging = array(); // Collect active reminders that have not yet been sent. $active_unsent_reminders = fetch_reminders('', 'unsent'); $logging['total_pre_unsent_reminders'] = count($active_unsent_reminders); // Send the unsent reminders $logging['number_success_emails'] = 0; $logging['number_failed_emails'] = 0; $logging['number_success_calls'] = 0; $logging['number_failed_calls'] = 0; foreach ($active_unsent_reminders as $reminder) { // Collect patient information that reminder is going to. $sql = "SELECT `fname`, `lname`, `email`, `phone_home`, `hipaa_voice`, `hipaa_allowemail` from `patient_data` where `pid`=?"; $result = sqlQueryCdrEngine($sql, array($reminder['pid'])); $patientfname = $result['fname']; $patientlname = $result['lname']; $patientemail = $result['email']; $patientphone = $result['phone_home']; $hipaa_voice = $result['hipaa_voice']; $hipaa_allowemail = $result['hipaa_allowemail']; // Email to patient if Allow Email and set reminder sent flag. if ($hipaa_allowemail == "YES") { $mail = new MyMailer(); $sender_name = $GLOBALS['patient_reminder_sender_name']; $email_address = $GLOBALS['patient_reminder_sender_email']; $mail->FromName = $sender_name; // required $mail->Sender = $email_address; // required $mail->From = $email_address; // required $mail->AddAddress($patientemail, $patientfname . ", " . $patientlname); // required $mail->AddReplyTo($email_address, $sender_name); // required $category_title = generate_display_field(array('data_type' => '1', 'list_id' => 'rule_action_category'), $reminder['category']); $item_title = generate_display_field(array('data_type' => '1', 'list_id' => 'rule_action'), $reminder['item']); $mail->Body = "Dear " . $patientfname . ", This is a message from your clinic to remind you of your " . $category_title . ": " . $item_title; $mail->Subject = "Clinic Reminder"; if ($mail->Send()) { // deal with and keep track of this successful email sqlStatementCdrEngine("UPDATE `patient_reminders` SET `email_status`='1', `date_sent`=NOW() WHERE id=?", array($reminder['id'])); $logging['number_success_emails']++; } else { // deal with and keep track of this unsuccesful email $logging['number_failed_emails']++; } } // Call to patient if Allow Voice Message and set reminder sent flag. if ($hipaa_voice == "YES") { /****************************************************************************** * // Maviq does not work, is not currently supported, and seems to break on windows servers, so this * // feature has been commented out for now. * // Automated VOIP service provided by Maviq. Please visit http://signup.maviq.com for more information. * $siteId = $GLOBALS['phone_gateway_username']; * $token = $GLOBALS['phone_gateway_password']; * $endpoint = $GLOBALS['phone_gateway_url']; * $client = new MaviqClient($siteId, $token, $endpoint); * //Set up params. * $data = array( * "firstName" => $patientfname, * "lastName" => $patientlname, * "phone" => $patientphone, * //"apptDate" => "$scheduled_date[1]/$scheduled_date[2]/$scheduled_date[0]", * "timeRange" => "10-18", * "type" => "reminder", * "timeZone" => date('P'), * "greeting" => str_replace("[[sender]]", $sender_name, str_replace("[[patient_name]]", $patientfname, $myrow['reminder_content'])) * ); * * // Make the call. * $response = $client->sendRequest("appointment", "POST", $data); * * if ($response->IsError) { * // deal with and keep track of this unsuccessful call * $logging['number_failed_calls']++; * } * else { * // deal with and keep track of this succesful call * sqlStatementCdrEngine("UPDATE `patient_reminders` SET `voice_status`='1', `date_sent`=NOW() WHERE id=?", array($reminder['id']) ); * $logging['number_success_calls']++; * } *******************************************************************************/ } } // For logging purposes only: // Collect active reminders that have not yet been sent. $logging['total_post_unsent_reminders'] = count(fetch_reminders('', 'unsent')); return $logging; }
/** * This function delivers a document to the intended recipient. * Will need to test for Hylafax. * Will need code for Direct messaging. * Will need expansion to other methods of delivery. * Works for email-to-fax. * To be HIPPA compliant fax address must be behind secure firewall with this server. * Some suggest the fax server to fax machine portion of efaxing is not HIPPA compliant, no matter how it is done. * Thus faxing is not HIPPA compliant, and if that affects you, don't deliver this way. */ function deliver_document($task) { //use PHPMAILER $query = "SELECT * FROM users WHERE id=?"; $to_data = sqlQuery($query, array($task['TO_ID'])); $from_data = sqlQuery($query, array($task['FROM_ID'])); $sql = "SELECT * FROM facility ORDER BY billing_location DESC LIMIT 1"; $facility_data = sqlQuery($sql); $query = "SELECT * FROM patient_data where pid=?"; $patientData = sqlQuery($query, array($task['PATIENT_ID'])); $from_fax = preg_replace("/[^0-9]/", "", $facility_data['fax']); $from_name = $from_data['fname'] . " " . $from_data['lname']; $from_fac = $from_facility['name']; $to_fax = preg_replace("/[^0-9]/", "", $to_data['fax']); $to_name = $to_data['fname'] . " " . $to_data['lname']; $pt_name = $patientData['fname'] . ' ' . $patientData['lname']; $encounter = $task['ENC_ID']; $mail = new MyMailer(); $to_email = $to_fax . "@" . $GLOBALS['hylafax_server']; $email_sender = $GLOBALS['patient_reminder_sender_email']; //consider using admin email = Notification Email Address //this must be a fax server approved From: address $file_to_attach = preg_replace('/^file:\\/\\//', "", $task['DOC_url']); $file_name = preg_replace('/^.*\\//', "", $task['DOC_url']); $cover_page = "We are processing this file: " . $filepath . '/' . $filename; $mail->AddReplyTo($email_sender, $from_name); $mail->SetFrom($email_sender, $from_name); $mail->AddAddress($to_email); //, $to_name); $mail->Subject = $from_fax; $mail->MsgHTML("<html><HEAD> <TITLE>Fax Central openEMR</TITLE> <BASE HREF='http://www.oculoplasticsllc.com'> </HEAD><body><div class='wrapper'>" . $cover_page . "</div></body></html>"); $mail->IsHTML(true); $mail->AltBody = $cover_page; $mail->AddAttachment($file_to_attach, $file_name); if ($mail->Send()) { return true; } else { $email_status = $mail->ErrorInfo; error_log("EMAIL ERROR: " . $email_status, 0); return false; } }
function document_send($email, $body, $attfile, $pname) { if (empty($email)) { $this->assign("process_result", "Email could not be sent, the address supplied: '{$email}' was empty or invalid."); return; } $desc = "Please check the attached patient document.\n Content:" . attr($body); $mail = new MyMailer(); $from_name = $GLOBALS["practice_return_email_path"]; $from = $GLOBALS["practice_return_email_path"]; $mail->AddReplyTo($from, $from_name); $mail->SetFrom($from, $from); $to = $email; $to_name = $email; $mail->AddAddress($to, $to_name); $subject = "Patient documents"; $mail->Subject = $subject; $mail->Body = $desc; $mail->AddAttachment($attfile); if ($mail->Send()) { $retstatus = "email_sent"; } else { $email_status = $mail->ErrorInfo; //echo "EMAIL ERROR: ".$email_status; $retstatus = "email_fail"; } }
require_once "{$srcdir}/formdata.inc.php"; require_once $GLOBALS['srcdir'] . "/classes/postmaster.php"; $alertmsg = ''; $bg_msg = ''; $set_active_msg = 0; $show_message = 0; /* Sending a mail to the admin when the breakglass user is activated only if $GLOBALS['Emergency_Login_email'] is set to 1 */ $bg_count = count($access_group); $mail_id = explode(".", $SMTP_HOST); for ($i = 0; $i < $bg_count; $i++) { if ($_POST['access_group'][$i] == "Emergency Login" && $_POST['active'] == 'on' && $_POST['pre_active'] == 0) { if ($_POST['get_admin_id'] == 1 && $_POST['admin_id'] != "") { $res = sqlStatement("select username from users where id= ? ", array($_POST["id"])); $row = sqlFetchArray($res); $uname = $row['username']; $mail = new MyMailer(); $mail->From = $GLOBALS["practice_return_email_path"]; $mail->FromName = "Administrator OpenEMR"; $text_body = "Hello Security Admin,\n\n The Emergency Login user " . $uname . " was activated at " . date('l jS \\of F Y h:i:s A') . " \n\nThanks,\nAdmin OpenEMR."; $mail->Body = $text_body; $mail->Subject = "Emergency Login User Activated"; $mail->AddAddress($_POST['admin_id']); $mail->Send(); } } } /* To refresh and save variables in mail frame */ if (isset($_POST["privatemode"]) && $_POST["privatemode"] == "user_admin") { if ($_POST["mode"] == "update") { if (isset($_POST["username"])) { // $tqvar = addslashes(trim($_POST["username"]));
function emailLogin($patient_id, $message) { $patientData = sqlQuery("SELECT * FROM `patient_data` WHERE `pid`=?", array($patient_id)); if ($patientData['hipaa_allowemail'] != "YES" || empty($patientData['email']) || empty($GLOBALS['patient_reminder_sender_email'])) { return false; } if (!validEmail($patientData['email'])) { return false; } if (!validEmail($GLOBALS['patient_reminder_sender_email'])) { return false; } $mail = new MyMailer(); $pt_name = $patientData['fname'] . ' ' . $patientData['lname']; $pt_email = $patientData['email']; $email_subject = xl('Access Your Patient Portal'); $email_sender = $GLOBALS['patient_reminder_sender_email']; $mail->AddReplyTo($email_sender, $email_sender); $mail->SetFrom($email_sender, $email_sender); $mail->AddAddress($pt_email, $pt_name); $mail->Subject = $email_subject; $mail->MsgHTML("<html><body><div class='wrapper'>" . $message . "</div></body></html>"); $mail->IsHTML(true); $mail->AltBody = $message; if ($mail->Send()) { return true; } else { $email_status = $mail->ErrorInfo; error_log("EMAIL ERROR: " . $email_status, 0); return false; } }
// $content $to_email = $test_email; $to_name = $test_name; $to_firstname = $test_firstname; // Testmail verschicken.. $REX['GG'] = true; $REX['REDAXO'] = true; $REX_ARTICLE = new article(); $REX_ARTICLE->setCLang(0); $REX_ARTICLE->setArticleId($mail_aid); // $REX_ARTICLE->setTemplateId(xx); $content = $REX_ARTICLE->getArticleTemplate(); $REX['GG'] = false; $REX['REDAXO'] = true; // Allgemeine Initialisierung $mail = new MyMailer(); $mail->AddAddress($to_email); $mail->From = $mail_reply; $mail->FromName = $mail_reply; // Subject $subject = $mail_subject; $subject = str_replace("###EMAIL###", "{$to_email}", $subject); $subject = str_replace("###NAME###", "{$to_name}", $subject); $subject = str_replace("###FIRSTNAME###", "{$to_firstname}", $subject); // Bodies // html $html_body = $content; $html_body = str_replace("###EMAIL###", "{$to_email}", $html_body); $html_body = str_replace("###NAME###", "{$to_name}", $html_body); $html_body = str_replace("###FIRSTNAME###", "{$to_firstname}", $html_body); // text
if ($_GET['proc'] == "del") { foreach ($_POST['frmDelete'] as $key => $value) { $query = "DELETE FROM " . $phpml['dbMsgs'] . "\n WHERE msgid = {$key}"; $result = mysql_query($query) or die($PHPML_LANG["error_query"] . mysql_error()); echo $PHPML_LANG["campaign"] . " ID " . $key . " " . $PHPML_LANG["deleted"] . "<br>"; } echo '<meta http-equiv="refresh" content="3;url=index.php?pg=campaigns" />'; } elseif ($_POST['sendemail'] || $_POST['savenosend']) { if ($_POST['sendemail']) { $query = "SELECT *\n FROM " . $phpml['dbLists'] . "\n WHERE listid = " . $_SESSION['def_list']; $result = mysql_query($query) or die($PHPML_LANG["error_query"] . mysql_error()); $row = mysql_fetch_assoc($result); $phpml['FromName'] = $row['listowner']; $phpml['FromAddy'] = $row['listemail']; _load_PHPMailer(); $mail = new MyMailer(); $mail->Subject = stripslashes($_POST['emailtitle']); $message_org = stripslashes(stripslashes($_POST['frmEditor'])) . "</div>"; $query = "SELECT *\n FROM " . $phpml['dbMembers'] . "\n WHERE listid = '" . $_SESSION['def_list'] . "'\n AND confirmed = '1'\n AND deleted = '0'"; $result = mysql_query($query) or die($PHPML_LANG["error_query"] . mysql_error()); $num = mysql_num_rows($result); $x_ok = 0; // current count of sent in emails processed $x_errors = 0; // current count of errors in emails processed $xi = 0; // current count of emails processed $width = 0; // the starting width of the progress bar $percentage = 0; // the starting percentage (should always be zero)
function showAll() { $this->tpl->setMainTemplate("structure_mail.tpl"); $this->request->setModuleName('view_visits_rss'); $allSiteArchive = DataModel::getSites(); /** * Cache Lite */ $options = array('cacheDir' => DIR_CACHE_MAIL, 'lifeTime' => CACHE_MAIL_LIFETIME); $Cache_Lite = new Cache_Lite($options); $lang =& Lang::getInstance(); // case update to 2.2RC1 without executing global info if (!defined('INTERFACE_DEFAULT_LANG')) { define('INTERFACE_DEFAULT_LANG', 'en-utf-8.php'); } $lang->setNewLang(INTERFACE_DEFAULT_LANG); /** * Compute mails */ $o_config =& PmvConfig::getInstance(); foreach ($allSiteArchive as $infoSite) { /** * php Mailer */ $mail = new MyMailer(); $mail->IsHTML(true); $imgUrl = INCLUDE_PATH . "/themes/default/images/phpmv.png"; $mail->AddEmbeddedImage($imgUrl, "my-attach", $GLOBALS['lang']['logo_description'], "base64", "image/png"); $uniqCacheId = md5(serialize($infoSite) . date("Y-m-d")) . '.mail'; // Test if thereis a valide cache for this id if (true) { $o_mod = new ViewVisitsRss($infoSite); $this->request->date = getDateFromTimestamp(time() - 86400); $o_mod->init($this->request); $dateLiteral = $o_mod->data->archive->getLiteralDate(); $body = '<html xml:lang="fr" > <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> '; $body .= $o_mod->showAll(true, true); $body .= '</body></html>'; $textBody = strip_tags($body); $subject = vsprintf($GLOBALS['lang']['rss_titre'], array($infoSite->getName(), $dateLiteral)); print "<br>Subject : {$subject}<hr>"; print "<br>Content : {$body}<hr>"; //$Cache_Lite->save($body); } $mail->Subject = $subject; $mail->Body = $body; $mail->AltBody = $textBody; $mail->CharSet = $GLOBALS['lang']['charset']; $user = new UserConfigDb(); $groups = $user->getGroups(); $users = array_merge(array(0 => array('email' => SU_EMAIL, 'alias' => 'phpMyVisites Administrator', 'send_mail' => SEND_MAIL == "yes" ? 1 : 0)), $user->getUserByGroup(1, $infoSite->getId()), $user->getUserByGroup(2, $infoSite->getId())); // we send all emails once $emailsToSend_infos = array('object' => $mail, 'to' => array()); // add recipients for the mail foreach ($users as $userInfo) { //print_r($userInfo); if (!empty($userInfo['email']) && $userInfo['send_mail'] == 1) { $emailsToSend_infos['to'][] = array($userInfo['email'], $userInfo['alias']); } } $emailsToSend[] = $emailsToSend_infos; } // send all emails foreach ($emailsToSend as $currMail) { $mail =& $currMail['object']; foreach ($currMail['to'] as $recipient) { $mail->AddAddress($recipient[0], $recipient[1]); if (!@$mail->Send()) { echo "<u><b>There was an error sending the message to " . $userInfo['email'] . "</u></b><br>"; } else { echo "<u><b>Message was sent successfully to " . $userInfo['email'] . "</u></b><br>"; } $mail->ClearAddresses(); } } }
function actionLost() { $arrResult = []; $sql = 'SELECT * FROM `users` WHERE `email` = :email'; $db = new Db(); $users = $db->dbSelect($sql, [':email' => $_GET['email']])[0]; if (empty($users)) { $arrResult['result'] = false; $arrResult['message'] = 'Email не зарегистрирован'; } else { $username = $users->username; $tmstamp = time(); $token = md5($username . $tmstamp); $sql = 'UPDATE `users` SET `email_token` = :token, `email_token_tmstamp` = :tmstamp WHERE `email` = :email'; $db = new Db(); $res = $db->dbExecute($sql, [':token' => $token, ':tmstamp' => $tmstamp, ':email' => $_GET['email']]); if (!$res) { $arrResult['result'] = false; $arrResult['message'] = 'Не удалось создать сссылку.'; } else { $email = new MyMailer(); $email->addAddress($_GET['email']); $email->username = $username; $email->href = 'http://probation/pwd.php?user='******'&token=' . $token; $email->date = date('d.m.y H:i:s', $tmstamp); if ($email->sendMail()) { $arrResult['result'] = true; $arrResult['message'] = 'Вам направлено письмо'; } else { $arrResult['result'] = false; $arrResult['message'] = 'Не удалось отправить письмо'; } } } echo json_encode($arrResult, JSON_UNESCAPED_UNICODE); }
function send_message($address, $message) { global $phpml; require_once $phpml['PHPMailer_path'] . "/class.html2text.php"; // added by Steve Morton $rc = false; if ($phpml['EmailSend']) { if (!class_exists("MyMailer")) { _load_PHPMailer(); } // code added by Steve Morton $h2t =& new html2text($message); $textmsg = $h2t->get_text(); // end of code added by Steve Morton $mail = new MyMailer(); $mail->Subject = stripslashes('[' . $phpml['ListName'] . '] Mailing List'); // code added by Steve Morton $mail->AltBody = $textmsg; $mail->MsgHTML($message); // end of code added by Steve Morton $mail->AddAddress($address); if (!$mail->Send()) { $_SESSION['return_msg'] = "There has been a mail error sending to " . $address . ": " . $mail->ErrorInfo; } else { $rc = true; } $mail->ClearAddresses(); } return $rc; }