function send_new_project_email(Project $project) { $ugroup_manager = new UGroupManager(); $admin_ugroup = $ugroup_manager->getUGroup($project, ProjectUGroup::PROJECT_ADMIN); $mail_manager = new MailManager(); $hp = Codendi_HTMLPurifier::instance(); foreach ($admin_ugroup->getMembers() as $user) { /* @var $user PFUser */ $language = $user->getLanguage(); $subject = $GLOBALS['sys_name'] . ' ' . $language->getText('include_proj_email', 'proj_approve', $project->getUnixName()); $message = ''; include $language->getContent('include/new_project_email', null, null, '.php'); $mail = $mail_manager->getMailByType('html'); $mail->getLookAndFeelTemplate()->set('title', $hp->purify($subject, CODENDI_PURIFIER_CONVERT_HTML)); $mail->setTo($user->getEmail()); $mail->setSubject($subject); $mail->setBodyHtml($message); $mail->send(); } return true; }
$purifier = Codendi_HTMLPurifier::instance(); if (isset($send_mail)) { if (!$subject || !$body || !$email) { /* force them to enter all vars */ exit_missing_param(); } $csrf_token->check(); $valid = new Valid_Text('cc'); $valid->required(); if ($request->valid($valid)) { $cc = $request->get('cc'); } $mailMgr = new MailManager(); $mail = $mailMgr->getMailByType(); if (isset($touser)) { //Return the user given its user_id $to = $um->getUserById($touser); if (!$to) { exit_error($Language->getText('include_exit', 'error'), $Language->getText('sendmessage', 'err_nouser')); } $mail->setToUser(array($to)); $dest = $to->getRealName(); } else { if (isset($toaddress)) { $to = eregi_replace('_maillink_', '@', $toaddress); $mail->setTo($to); $dest = $to; } }
} $validFormat = new Valid_WhiteList('body_format', array(0, 1)); $bodyFormat = $request->getValidated('body_format', $validFormat, 0); $validMessage = new Valid_Text('mail_message'); if ($request->valid($validMessage)) { $mailMessage = $request->get('mail_message'); } $mailSubject = ''; $validSubject = new Valid_String('mail_subject'); if ($request->valid($validSubject)) { $mailSubject = $request->get('mail_subject'); } $mailMgr = new MailManager(); if ($bodyFormat) { $hp = Codendi_HTMLPurifier::instance(); $mail = $mailMgr->getMailByType('html'); $mail->getLookAndFeelTemplate()->set('title', $hp->purify($mailSubject, CODENDI_PURIFIER_CONVERT_HTML)); $mail->setBodyHtml($mailMessage); } else { $mail = $mailMgr->getMailByType('text'); $mail->setBody($mailMessage); } $mail->setSubject($mailSubject); if ($destination != 'preview') { site_header(array('title' => $Language->getText('admin_massmail', 'title'))); print '<h2>' . $Language->getText('admin_massmail', 'header', array($GLOBALS['sys_name'])) . '</h2>'; print $Language->getText('admin_massmail_execute', 'mailing', array(db_numrows($res_mail))) . " ({$to_name})<br><br>"; flush(); $rows = db_numrows($res_mail); $tolist = ''; for ($i = 1; $i <= $rows; $i++) {