3 * Batch Email processor, included from batchcom
6 * @link http://www.open-emr.org
8 * @author Jason 'Toolbox' Oettinger <jason@oettinger.email>
9 * @copyright Copyright (c) 2008 cfapress
10 * @copyright Copyright (c) 2017 Jason 'Toolbox' Oettinger <jason@oettinger.email>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 // create file header.
15 // menu for fields could be added in the future
16 require_once("../globals.php");
17 use OpenEMR\Core\Header
;
22 <title
><?php
echo xlt('Email Notification Report'); ?
></title
>
23 <?php Header
::setupHeader(); ?
>
25 <body
class="body_top container">
27 <?php
require_once("batch_navigation.php");?
>
28 <h1
class="col-md-12">
29 <a href
="batchcom.php"><?php
echo xlt('Batch Communication Tool')?
></a
>
30 <small
><?php
echo xlt('Email Notification Report'); ?
></small
>
34 <ul
class="col-md-12">
36 $email_sender = $_POST['email_sender'];
37 $sent_by = $_SESSION["authId"];
39 while ($row = sqlFetchArray($res)) {
40 // prepare text for ***NAME*** tag
41 $pt_name = $row['title'].' '.$row['fname'].' '.$row['lname'];
42 $pt_email = $row['email'];
44 $email_subject = $_POST['email_subject'];
45 $email_body = $_POST['email_body'];
46 $email_subject = preg_replace('/\*{3}NAME\*{3}/', $pt_name, $email_subject);
47 $email_body = preg_replace('/\*{3}NAME\*{3}/', $pt_name, $email_body);
49 $headers = "MIME-Version: 1.0\r\n";
50 $headers .= "To: $pt_name<".$pt_email.">\r\n";
51 $headers .= "From: <".$email_sender.">\r\n";
52 $headers .= "Reply-to: <".$email_sender.">\r\n";
53 $headers .= "X-Priority: 3\r\n";
54 $headers .= "X-Mailer: PHP mailer\r\n";
55 if (mail($pt_email, $email_subject, $email_body, $headers)) {
56 echo "<li>" . xlt('Email sent to') . ": " . text($pt_name) . " , " . text($pt_email) . "</li>";
66 echo '<div class="alert alert-danger">' . xlt('Could not send email due to a server problem.') . ' ' . $m_error_count . ' ' . xlt('emails not sent') . '</div>';