Пример #1
0
 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";
     }
 }
Пример #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;
    }
}