/** * 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; } }
$message = preg_replace('/%%lastname%%/i', $row['lastname'], $message); $message = preg_replace('/{ip}/i', $row['IP'], $message); $message = preg_replace('/%7Bip%7D/i', $row['IP'], $message); $message = preg_replace('/%%ip%%/i', $row['IP'], $message); $message = preg_replace('/{remote_host}/i', $row['RH'], $message); $message = preg_replace('/%7Bremote_host%7D/i', $row['RH'], $message); $message = preg_replace('/%%remote_host%%/i', $row['RH'], $message); $message = preg_replace('/{reg_date}/i', date("F j, Y, g:i a", $row['regdate']), $message); $message = preg_replace('/%7Breg_date%7D/i', date("F j, Y, g:i a", $row['regdate']), $message); $message = preg_replace('/%%reg_date%%/i', date("F j, Y, g:i a", $row['regdate']), $message); $h2t =& new html2text($message); $textmsg = $h2t->get_text(); if ($_POST['frmFormat'] == 'textonly') { $mail->Body = $textmsg; } else { $mail->MsgHTML($message); $mail->AltBody = $textmsg; //"To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test } // now send it if (!$mail->Send()) { $x_errors++; echo $PHPML_LANG["error_sending"] . " to:" . $row['email'] . "<br /><br /><b>" . $mail->ErrorInfo . "<br /><br /></b>"; } else { $x_ok++; } if ($num > 1) { $mail->ClearAddresses(); $mail->ClearCCs(); $mail->ClearBCCs(); $mail->ClearReplyTos();
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; } }
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; }