function notificarHabilitacionValidar($params) { $planilla = new Planilla(); $torneo = $params['torneo']; $rueda = $params['rueda']; $fecha = $params['numero_fecha']; $partido = $params['partido']; $HTMLTorneoFechaPartido = MailService::getHTMLTorneoFechaPartido($torneo, $rueda, $fecha, $partido); // Se obtiene la lista de emails del los usuarios del equipo perdedor o // visitante en caso de empate $mails = $planilla->getMailsParaValidar($torneo, $rueda, $fecha, $partido); $body .= "<br/><br/>"; $body .= "La planilla con código " . $torneo . "-" . $rueda . "-" . $fecha . "-" . $partido . " fue marcada como Cargada Final y esta lista para ser validada."; $body .= "<br/><br/>"; $body .= "Para acceder directamente a la planilla haga clic "; $body .= "<a href='" . DIRECCION_SITIO . "/index.php?accion=planilla_vista_validar&torneo={$torneo}&rueda={$rueda}&numero_fecha={$fecha}&partido={$partido}'>aquí</a>"; $body .= "<br/><br/>"; $params["TEMPLATE"] = "TEMPLATE_AVISO_PROCESOS"; $params["subject"] = "AAAHSC - Planilla " . $torneo . "-" . $rueda . "-" . $fecha . "-" . $partido . " habilitada para validacion"; $params["to"] = $mails; $params["bcc"] = getBccProceso("AvisoValidacion"); $params["body"] = $body; $this->asignar('body', $body); $ok_mail = MailHelper::sendmail($params); return $ok_mail; }
public function send_message() { $this->load->model('entities/message'); $message = new Message(); $message->initialize($this->input->post()); MessagesManagement::insert_message($message); MailService::send_mail($message); redirect(base_url() . "contact", "location"); }
/** * This is notice action */ public function actionNotice() { if (!isset($_GET['authkey']) || '12315454364625223345467' != $_GET['authkey']) { echo 'notice authkey wrong!'; return; } $activeProductIdStr = $this->getActiveProductId(); $assignToUserArr = $this->getNoticeUser($activeProductIdStr); foreach ($assignToUserArr as $assignUser) { $assignedBugArr = Yii::app()->db->createCommand()->select('id,severity,priority,title,bug_status,created_by_name,assign_to_name,resolved_by_name,solution,updated_at')->from('{{bugview}}')->where('assign_to=' . $assignUser['id'] . ' and product_id in(' . $activeProductIdStr . ') and bug_status<>"Closed"')->order('id desc')->queryAll(); $subject = Yii::t('BugInfo', 'Bugs assigned to you by now:') . ' ' . count($assignedBugArr); $messageContent = $this->render('notice', array('bugArr' => $assignedBugArr, 'assignedUser' => $assignUser), true); MailService::sysMail($assignUser['email'], '', $subject, $messageContent); } }
/** * @param form_persistentdocument_baseform $form * @param form_persistentdocument_response $response * @param block_BlockRequest $request * @param array $result * @param String $acknowledgmentReceiver * @param String $replyTo * @return void */ protected function sendAcknowledgement($form, $response, $request, $result, $acknowledgmentReceiver, $replyTo) { $recipients = new mail_MessageRecipients(); $recipients->setTo(array($acknowledgmentReceiver)); $parameters = $this->getAcknowledgementNotificationParameters($form, $response, $request, $result, $acknowledgmentReceiver, $replyTo); if (Framework::isDebugEnabled()) { Framework::debug(__METHOD__ . " Form \"" . $form->getLabel() . "\" (id=" . $form->getId() . ")"); Framework::debug(__METHOD__ . " Parameters: " . var_export($parameters, true)); Framework::debug(__METHOD__ . " To : " . join(", ", $recipients->getTo())); Framework::debug(__METHOD__ . " ReplyTo : " . $replyTo); } $ns = notification_NotificationService::getInstance(); $ns->setMessageService(MailService::getInstance()); $notification = $form->getAcknowledgmentNotification(); $senderEmail = $this->getOverrideNotificationSender($form); return $ns->send($notification, $recipients, $parameters, 'form', $replyTo, $senderEmail); }
/** * send mail message after action * * @author youzhao.zxw<*****@*****.**> * @param int $infoId info id * @param string $infoType bug,case or result * @param int $actionId action id * @param string $repeatStep repeat step * @param string $replyNote reply note * @return */ private static function sendMessage($infoId, $infoType, $actionId, $repeatStep = '', $replyNote = '') { $className = ucfirst(strtolower($infoType)) . 'Info'; $targetModel = new $className(); $basicInfo = $targetModel->model()->findByPk($infoId); list($mailMsg, $wangwangMsg) = self::getMessageContent($basicInfo, $infoType, $actionId, $repeatStep, $replyNote); $assignToEmail = ''; $wangwang = ''; if (!empty($basicInfo->assign_to)) { if (Yii::app()->user->id != $basicInfo->assign_to) { $assignUserInfo = TestUser::model()->findByPk($basicInfo->assign_to); $assignToEmail = self::getUserEmail($assignUserInfo); $wangwang = self::getWangwang($assignUserInfo); } } $ccArr = self::getCCList($basicInfo, $assignToEmail); MailService::sysMail($assignToEmail, $ccArr, ucfirst(strtolower($infoType)) . ' #' . $infoId . ' ' . CommonService::sysSubStr($basicInfo['title'], 150, true), $mailMsg); }
/** * @param form_persistentdocument_form $form * @param form_persistentdocument_response $response * @param block_BlockRequest $request * @param String $copyMail * @param String $replyTo * @return void */ private function sendEmail($form, $response, $request, $copyMail, $replyTo) { $recipients = new mail_MessageRecipients(); if ($request->hasParameter('receiverIds')) { $this->handleReceveirIds($request->getParameter('receiverIds'), $recipients); } // Determine the message recipients for this form. // Note that the following method may be overriden to allow the developper // to build specific mail recipients, depending on the request data for // example. $this->buildMessageRecipients($form, $recipients, $request); if (!$recipients->isEmpty()) { if ($form->getMessageSendingType() == self::SEND_EMAIL_AND_APPEND_TO_MAILBOX) { $messageService = mailbox_MessageService::getInstance(); Framework::debug(__METHOD__ . " Getting mailbox_MessageService instance."); } else { $messageService = MailService::getInstance(); Framework::debug(__METHOD__ . " Getting MailService instance."); } $contentTemplate = TemplateLoader::getInstance()->setPackageName('modules_form')->setMimeContentType(K::HTML)->load('Form-MailContent'); $contentTemplate->setAttribute('items', $response->getAllData()); $contentTemplate->setAttribute('response', $response->getResponseInfos()); $parameters = $response->getData(); $parameters[self::CONTENT_REPLACEMENT_NAME] = $contentTemplate->execute(); $parameters[self::FORM_LABEL_REPLACEMENT_NAME] = $form->getLabel(); if (Framework::isDebugEnabled()) { Framework::debug(__METHOD__ . " Form \"" . $form->getLabel() . "\" (id=" . $form->getId() . ")"); Framework::debug(__METHOD__ . " Parameters: " . var_export($parameters, true)); if ($recipients->hasTo()) { Framework::debug(__METHOD__ . " To : " . join(", ", $recipients->getTo())); } if ($recipients->hasBCC()) { Framework::debug(__METHOD__ . " CC : " . join(", ", $recipients->getCC())); } if ($recipients->hasBCC()) { Framework::debug(__METHOD__ . " BCC : " . join(", ", $recipients->getBcc())); } Framework::debug(__METHOD__ . " ReplyTo : " . $replyTo); } $ns = notification_NotificationService::getInstance(); $ns->setMessageService($messageService); if ($copyMail === null) { return $ns->send($form->getNotification(), $recipients, $parameters, 'form', $replyTo, $this->getOverrideNotificationSender($form)); } else { $copyRecipient = new mail_MessageRecipients(); $copyRecipient->setTo(array($copyMail)); $notification = $form->getNotification(); $sender = $this->getOverrideNotificationSender($form); return $ns->send($notification, $recipients, $parameters, 'form', $replyTo, $sender) && $ns->send($notification, $copyRecipient, $parameters, 'form', $replyTo, $sender); } } return true; }
/** * List Mail Subscriptions * @param sfWebRequest $request * @return unknown_type */ public function executeListMailSubscriptions(sfWebRequest $request) { $this->form = new EmailSubscriptionsForm(array(), array(), true); $mailService = new MailService(); $user = $_SESSION['user']; $this->mailnot = array(); for ($i = -1; $i < 9; $i++) { $this->mailnot[$i] = ''; } if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName())); if ($this->form->isValid()) { $mailService->removeMailNotification($user); $postedStates = $request->getParameter('notificationMessageStatus'); for ($i = -1; $i < 9; $i++) { $notficationEmail = trim($request->getParameter('txtMailAddress_' . $i)); if (!empty($notficationEmail)) { $state = in_array($i, $postedStates) ? 1 : 0; $mailNotification = new MailNotification(); $mailNotification->setUserId($user); $mailNotification->setNotificationTypeId($i); $mailNotification->setStatus($state); $mailNotification->setEmail($notficationEmail); $mailService->saveMailNotification($mailNotification); } } } } $this->notficationList = $mailService->getMailNotificationList($user); $AllMailNotifications = $mailService->getAllMailNotifications(); foreach ($AllMailNotifications as $mailNotification) { $this->mailnot[$mailNotification->notification_type_id] = $mailNotification->email; } }
<?php /* * $limit максимальное количество писем, которые можна отправить за раз. * $base_mail адрес для обратной связи (адрес отправителя). * $notification_terms дни отправки уведомлений * &launch_interval интервал, с которым скрипт будет запускаться на сервере (в минутах). */ $limit = 100; $base_mail = '*****@*****.**'; $notification_terms = array(1, 2, 5, 10); $launch_interval = 15; $mail_sender = new MailService($limit, $base_mail, $notification_terms, $launch_interval); $mail_sender->send_mails(); //---------------------------------------------------------------------------------------------------------------------- /* * Класс позволяет вести запись возникших ошибок. */ class Logger { /* * Реализация-заглушка. */ public static function log_error(Exception $e) { //TODO вставить нужную реализацию. // $date = date('Y-m-d-H-i-s'); // echo "ERROR [{$date}]: {$e->getMessage()}<br/>"; } } //----------------------------------------------------------------------------------------------------------------------