コード例 #1
0
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;
    }
}
コード例 #2
0
/**
 *  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;
    }
}
コード例 #3
0
    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();
            }
        }
    }