function NotifyEventEmail($notify_toUser, $notify_fromUser, $notify_subject, $notify_body) { $tmp_manageUsers = new manageUsers(); $assigned_email = $tmp_manageUsers->get_userSingleDetail($notify_toUser, 'user_primaryEmail'); $from_email = $tmp_manageUsers->get_userSingleDetail($notify_fromUser, 'user_primaryEmail'); $email = new sendaMail(); $email->messageTo($assigned_email); $email->asFrom($from_email); $email->AddCC("comments_{$_SESSION['subdomain']}@discreteevents.com"); $email->subject($notify_subject); $email->body($notify_body); $email->send(); }
} // End of "Scheduled Tasks" // Scheduled Emails $thisMonth = date("m"); $thisYear = date("Y"); $thisDay = date("d"); $thisHour = date("H"); $result_scheduledEmails = mysql_query("select * from " . $thisdb . ".scheduledmails where email_sent='N' and DAYOFMONTH(email_scheduledon)='{$thisDay}' and MONTH(email_scheduledon)='{$thisMonth}' and YEAR(email_scheduledon)='{$thisYear}' and HOUR(email_scheduledon)='{$thisHour}' "); while ($row = @mysql_fetch_array($result_scheduledEmails)) { extract($row); // sch_emailid, emailby_user, emailby_from, email_to, email_content, email_subject, email_scheduledon, email_sent // send this email from this user to the destination, send a copy to the user $email = new sendaMail(); $containsAt = strpos($emailby_from, '@'); if ($containsAt) { $email->asFrom($emailby_from); } $email->messageTo($email_to); $email->subject($email_subject); $email->body($email_content); if ($email_to != $emailby_from) { $email->AddBCC($emailby_from); } $email->send(); //echo "sending email to ".$email_to ; // mark this email as sent $updated = mysql_query("update " . $thisdb . ".scheduledmails set email_sent='Y' where sch_emailid='{$sch_emailid}' "); } // End of "Scheduled Emails" } // email daily schedule report to serveradmin
while ($row = @mysql_fetch_array($report)) { if ($row['task_user'] != $currentUser) { $REPORTEMAIL[] = "\n---------------------"; $REPORTEMAIL[] = $row['task_user'] . " :"; $REPORTEMAIL[] = "---------------------"; } if ($row['task_day'] != $TMP_TODAY) { $REPORTEMAIL[] = "{$row['task_day']}, {$row['task_mins']} mins -- {$row['task_desc']}\n"; } else { $REPORTEMAIL[] = "{$row['task_mins']} mins -- {$row['task_desc']}\n"; } $currentUser = $row['task_user']; } $updateWasEmailed = mysql_query("update journalentries set wasEmailed='Y' "); $REPORTEMAIL_BODY = implode("\n", $REPORTEMAIL); $REPORTEMAIL_SUBJECT = "Daily Report for " . date("F j, Y"); $to = '*****@*****.**'; /* $headers = 'From: Daily Journal Report <*****@*****.**>' . "\r\n" . 'Cc: sanjayj@cigniti.com' . "\r\n" . //'Bcc: paripurnachand@gmail.com' . "\r\n" . 'Reply-To: chandu@cigniti.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $mailsent = @mail($to, $REPORTEMAIL_SUBJECT, $REPORTEMAIL_BODY, $headers); */ $email = new sendaMail(); $email->messageTo($to); $email->subject($REPORTEMAIL_SUBJECT); $email->body($REPORTEMAIL_BODY); $email->asFrom('*****@*****.**'); $email->send();
$responseEmail .= "\n" . "Task Created On : " . $taskDetails["work_dateAdded"]; $responseEmail .= "\n" . "Task Deadline : " . $taskDetails["work_deadLine"]; $responseEmail .= "\n\n" . "Comments : "; while ($row = mysql_fetch_assoc($comments_result)) { $responseEmail .= "\n" . "----------------------------------------------------"; $responseEmail .= "\n" . $row['comment_by'] . " on " . $row['comment_date']; $responseEmail .= "\n" . $row['comment']; } $responseEmail .= "\n\n"; } else { $responseEmail = $taskDetails["work_briefDesc"]; } $tmp_manageUsers = new manageUsers(); $user_fromEMailId = $tmp_manageUsers->get_userSingleDetail($USERNAME, 'user_primaryEmail'); $email = new sendaMail(); $email->asFrom($user_fromEMailId); $email->messageTo($toemailId); $email->subject("Details of task - " . $workid); $email->body($responseEmail); if ($includeAttachments == 'yes') { $COMMENTLOGMESSAGE .= "\n Included Attachments"; $attachments = mysql_query("select diskfilename, uploadname from attachments where workid='{$workid}' "); while ($row = mysql_fetch_assoc($attachments)) { $email->AddAttachment(APP_INSTALLPATH . 'attachments/' . $_SESSION["subdomain"] . '/' . $row['diskfilename'], $row['uploadname']); } } $email->send(); $manageWorks->addComment($workid, APPNAME, $COMMENTLOGMESSAGE); send_Action_Response('Success', "Details emailed !"); exit; break;