acknowledgments update
[openemr.git] / interface / batchcom / batchEmail.php
blobd76d1bc4df57033a7f011c92379a662024a92079
1 <?php
2 /*
3 batch Email processor, included from batchcom
4 */
6 // create file header.
7 // menu for fields could be added in the future
9 ?>
10 <html>
11 <head>
12 <?php html_header_show();?>
13 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
14 <link rel="stylesheet" href="batchcom.css" type="text/css">
15 </head>
16 <body class="body_top">
17 <span class="title"><?php xl('Batch Communication Tool','e')?></span>
18 <br><br>
19 <span class="title" ><?php xl('Email Notification Report','e')?></span>
20 <br><br>
23 <?php
24 $email_sender=$_POST['email_sender'];
25 $sent_by=$_SESSION["authId"];
26 $msg_type=xl('Email from Batchcom');
28 while ($row=sqlFetchArray($res)) {
30 // prepare text for ***NAME*** tag
31 $pt_name=$row['title'].' '.$row['fname'].' '.$row['lname'];
32 $pt_email=$row['email'];
34 $email_subject=$_POST['email_subject'];
35 $email_body=$_POST['email_body'];
36 $email_subject=ereg_replace('\*{3}NAME\*{3}', $pt_name, $email_subject );
37 $email_body= ereg_replace('\*{3}NAME\*{3}', $pt_name, $email_body );
39 $headers = "MIME-Version: 1.0\r\n";
40 $headers .= "To: $pt_name<".$pt_email.">\r\n";
41 $headers .= "From: <".$email_sender.">\r\n";
42 $headers .= "Reply-to: <".$email_sender.">\r\n";
43 $headers .= "X-Priority: 3\r\n";
44 $headers .= "X-Mailer: PHP mailer\r\n";
45 if ( mail($pt_email,$email_subject,$email_body,$headers)) {
47 echo ("<br>" . xl('Email sent to') . ": " . text($pt_name) . " , " . text($pt_email) . "<br>");
49 } else {
50 $m_error=TRUE;
51 $m_error_count++;
56 if ($m_error) {
57 echo (xl('Could not send email due to a server problem. ','','<br>'). $m_error_count . xl(' emails not sent','',''));
60 ?>