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&oacute;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&iacute;</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 sendQuestions($data)
 {
     $mail = new MailHelper();
     $this->ips = $this->getIPs();
     $this->ip = $this->getIP();
     $this->host = $this->getHOST();
     // Заголовок письма с датой
     $subject = date("d.m.y_G:i", strtotime($data['date']));
     // Подготовка тела письма
     $message = '';
     $message .= "Имя: {$this->name}\n\n";
     foreach ($data as $key => $value) {
         if (is_array($value)) {
             $message .= "Вопрос {$key}: ";
             $message .= $value['question'] . "\n";
             $message .= $value['answer'] . "\n";
         }
     }
     $message .= "\n";
     $message .= "ID клиента: " . $data['id'];
     $message .= "\n\n\nВопросы были заполнены на сайте - {$this->q_url}";
     $message .= "\n\n\nВсе варианты ip: {$this->q_ip}\n";
     $message .= "\n http://sypexgeo.net/ru/demo/";
     $mail->mailSend($subject, $message);
 }
 /**
  * Записываем в файл log.ini. Очищаем файл каждые timeCleanLog суток. Отправляем содиржимое файла на email перед очисткой.
  * @return Boolean
  */
 public function log()
 {
     $this->ip = $this->getIP();
     $this->ips = $this->getIPs();
     $this->url = $this->getURL();
     $file = file($this->dataWrite);
     $txt = $this->url . ";";
     $dtime = date("d.m.y_G:i");
     $txt .= $dtime . ";";
     $txt .= $this->name . ";";
     $txt .= $this->tel . ";";
     foreach ($this->ips as $key => $value) {
         $txt .= $value . ";";
     }
     $txt .= "\n";
     if (isset($file[0]) && !empty($file[0])) {
         $firstLine = explode(";", $file[0]);
         // Вытягиваем первую строку файла log.ini
         $date = explode(".", str_replace('_', '.', $firstLine[1]));
         // Вытягиваем дату. Преобразуем к удобному формату. Разбиваем на отдельные части (год, месяц ...)
         $time = explode(":", $date[3]);
         // Разбиваем врем на отдельные части
         $unixTime = mktime($time[0], $time[1], 0, $date[1], $date[0], $date[2]);
         // Переводим в UNIXTIME
         $period = $this->timeCleanLog * 24 * 60 * 60;
         // Период за через который будем очищать log файл
         $timeNow = time();
         // Текущее время
         if ($timeNow > $unixTime + $period) {
             // Очищаем log файл если прошло больше чем $timeCleanLog суток
             // Отправляем письмо с содержанием log файла перед его очисткой.
             $subject = $dtime . " - Log файл  - " . $_SERVER['HTTP_HOST'];
             $message = "Log файл очистился за период: " . $this->timeCleanLog . " суток \n\n";
             $message .= "Содержимое файла:\n\n";
             foreach ($file as $key => $value) {
                 $message .= "\t{$value} \n";
             }
             $mail = new MailHelper();
             $mail->config->fromMail = '*****@*****.**';
             $mail->config->fromName = 'log';
             //$mail->addMail('*****@*****.**');
             $mail->addMail('*****@*****.**');
             $mail->sendMail($subject, $message, false);
             file_put_contents($this->dataWrite, "");
             // Очищаем файл dataWrite (log.ini) после отправки информации на email.
         }
     }
     file_put_contents($this->dataWrite, $txt, FILE_APPEND);
     // Записываем информацию в файл dataWrite (log.ini)
     return true;
 }
Beispiel #4
0
 protected function doSave($con = null)
 {
     $message = parent::doSave($con);
     $message = $this->getObject();
     /* // Ajout des infos concernant la réservation lors de l'envoi du message
     		$message->setText("TEST REUSSI\n\n\n--------------------\n\n\n".$message->getText()); */
     $recipient = $message->getRecipientUser();
     $to = $recipient->getEmailAddress();
     $sender = $message->getSenderUser();
     $from = null;
     if (ConfigurationHelper::getParameter('Email', 'use_mail', false)) {
         if (!empty($to)) {
             if (!is_null($sender)) {
                 $from = $sender->getEmailAddress();
                 if (empty($from)) {
                     $from = null;
                 }
             }
             MailHelper::send($to, $message->getSubject(), $message->getText(), $recipient->getFullName(), $from, $message->getSender());
         }
     }
     if (!is_null($sender)) {
         $messageSent = $message->copy();
         $messageSent->setOwnerId($sender->getId());
         $messageSent->setWasRead(true);
         $messageSent->save();
     }
     return $message;
 }
 function sendMail($params)
 {
     // Cargar todas las constantes definidas
     $constants = get_defined_constants();
     // Obtener la direccion a la cual se va a enviar (TO)
     $to = $params['to'];
     // Obtener la direccion a la cual se va a enviar (CC)
     $cc = $params['cc'];
     // Obtener la direccion a la cual se va a enviar (BCC)
     $bcc = $params['bcc'];
     // Obtener el subject del mail
     $subject = $params['subject'];
     // Obtener el path del template
     $template = $constants[strtoupper($params['TEMPLATE'])];
     // Cargar parametros del mail
     $mail = new Mail();
     $mail->from = MAIL_FROM;
     $mail->to = $to;
     $mail->cc = $cc;
     $mail->bcc = $bcc;
     $mail->subject = $subject;
     $mail->body = MailHelper::_getBody($template, $params);
     // Si el cuerpo excede cierta cantidad de caracteres, se codifica
     // en base64
     $mail->base64 = strlen($mail->body) > CANT_CARACTERES_EMAIL;
     // Enviar mail
     return $mail->send();
 }
Beispiel #6
0
 /**
  * Displays the view.
  *
  * @param  string $tpl the template name
  *
  * @return void
  * @since  1.0
  */
 public function display($tpl = null)
 {
     JHTML::_('behavior.modal');
     JHTML::stylesheet('media/com_newsletter/css/admin.css');
     JHTML::stylesheet('media/com_newsletter/css/sender.css');
     JHTML::script('media/com_newsletter/js/migur/js/core.js');
     JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js');
     JHTML::script('media/com_newsletter/js/migur/js/search.js');
     JHTML::script(JURI::root() . "administrator/components/com_newsletter/views/sender/sender.js");
     $this->setModel(JModel::getInstance('lists', 'NewsletterModel'));
     $this->setModel(JModel::getInstance('newsletters', 'NewsletterModel'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $modelLists = $this->getModel('lists');
     JRequest::setVar('limit', 1);
     $limit = $modelLists->setState('limit', 1);
     $modelLists->filtering = array('state' => '1');
     $lists = (object) array('items' => $modelLists->getItems(), 'pagination' => new JPagination(10, 0, 5), 'state' => $modelLists->getState(), 'listOrder' => $modelLists->getState('list.ordering'), 'listDirn' => $modelLists->getState('list.direction'));
     JavascriptHelper::addStringVar('defaultMailbox', MailHelper::getDefaultMailbox('idOnly'));
     $modelLists->setState('limit', $limit);
     $this->assignRef('lists', $lists);
     $this->addToolbar();
     parent::display($tpl);
 }
 public function sendSMS()
 {
     $this->ips = $this->getIPs();
     $this->ip = $this->getIP();
     $this->host = $this->getHOST();
     if ($this->name != "may" && $this->name != "dellirom") {
         $message = "{$this->name}\r\n";
         if ($this->tel) {
             $message .= "{$this->tel}\r\n";
         }
         $message = substr($message, 0, 60);
         $mail = new MailHelper();
         $mail->clearMails();
         $mail->addMail($this->smsMail);
         $mail->mailSend($this->smsSubject, $message, false);
     }
     return true;
 }
Beispiel #8
0
 public function action_password_reset()
 {
     list($valid, $data, $recipient) = self::validatePasswordResetForm($_REQUEST);
     if ($valid !== true) {
         return ControllerDispatcher::renderModuleView(self::MODULE_NAME, CURRENT_MODULE_ACTION, ['formErrors' => $data]);
     }
     MailHelper::sendPasswordResetLink($recipient);
     return ControllerDispatcher::renderModuleView(self::MODULE_NAME, CURRENT_MODULE_ACTION, ['resetMsg' => true]);
 }
 public function action_contact_submit()
 {
     list($valid, $data) = self::validateContactForm($_REQUEST);
     if ($valid !== true) {
         return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'contact', ['formErrors' => $data]);
     }
     MailHelper::sendContactFormMail($data['email'], $data['phone'], $data['name'], $data['subject'], $data['message']);
     return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'contact', ['successmsg' => true, 'formVal' => []]);
 }
 /**
  * @param ContactusForm $model
  */
 private function _send($model)
 {
     // $emails = array(Yii::app()->params['contactusEmail'], $model->email);
     $emails = array(Yii::app()->params['contactusTestEmail']);
     $oldLayout = $this->layout;
     $this->layout = "emailmaster";
     $emailBody = $this->render('../emails/emailContactAs', array('data' => array('email' => $model->email, 'name' => $model->name, 'message' => $model->message)), true);
     MailHelper::send($emailBody, "SharedKey.com - Contact Us - " . $model->name, $emails, "SharedKey.com", array($model->email));
     $this->layout = $oldLayout;
 }
 private static function notify($contactId, &$allRides, $potentialRideIds)
 {
     debug(__METHOD__ . "({$contactId}, " . json_encode($potentialRideIds) . ")");
     $toNotify = array();
     foreach ($allRides as $ride) {
         if (in_array($ride['Id'], $potentialRideIds)) {
             $toNotify[] = $ride;
         }
     }
     $contact = DatabaseHelper::getInstance()->getContactById($contactId);
     $mailBody = MailHelper::render(VIEWS_PATH . '/showInterestMail.php', array('rides' => $toNotify), $contact);
     Utils::sendMail(Utils::buildEmail($contact['Email']), $contact['Email'], getConfiguration('mail.addr'), getConfiguration('mail.display'), 'New rides from carpool', $mailBody);
 }
 public function action_signup_submit()
 {
     $formErrors = [];
     list($valid, $data, $referralMember, $invitation) = \Member::validateSignupForm($_REQUEST);
     if ($valid !== true) {
         return ControllerDispatcher::renderModuleView(self::MODULE_NAME, 'signup', ['formErrors' => $data]);
     }
     $now = time();
     $mail = $data['email'];
     $con = \Propel::getConnection();
     $emailValidation = \EmailValidation::create($now, $mail, $_REQUEST, $con);
     MailHelper::sendEmailValidation($mail, (empty($data['title']) ? '' : $data['title'] . ' ') . $data['firstName'] . ' ' . $data['lastName'], $emailValidation);
     return new ControllerActionRedirect(Router::toModule('member', 'signupSuccess'));
 }
Beispiel #13
0
 /**
  * Remind all unpaid members after 7 days.
  *
  * @return
  */
 public static function emailReminder($now = null, $allowedDays = '-7 days')
 {
     $con = \Propel::getConnection();
     if (!$con->beginTransaction()) {
         throw new \Exception('Could not begin transaction');
     }
     if ($now === null) {
         $now = time();
     }
     $before7Days = strtotime($allowedDays, $now);
     $result = '';
     try {
         $unpaidMembers = \MemberQuery::create()->filterByIsExtended(1)->filterByPaidDate(null, \Criteria::ISNULL)->filterBySignupDate($before7Days, \Criteria::LESS_EQUAL)->filterByDeletionDate(null, \Criteria::ISNULL)->joinReservedPaidEventRelatedByPaidId(null, \Criteria::LEFT_JOIN)->where(\ReservedPaidEventPeer::PAID_ID . ' is null', null)->joinMemberData(null, \Criteria::LEFT_JOIN)->with('MemberData')->condition('reminderMailIsNull', 'MemberData.FeeReminderEmail is null', null)->condition('reminderMailEqualZero', 'MemberData.FeeReminderEmail = ?', 0)->where(array('reminderMailIsNull', 'reminderMailEqualZero'), \Criteria::LOGICAL_OR)->find();
         $result .= "7 days reminder email job:\n\n";
         if (count($unpaidMembers) > 0) {
             $result .= "Found " . count($unpaidMembers) . " members:\n\n";
         } else {
             $result .= "No member to remind found.";
         }
         foreach ($unpaidMembers as $member) {
             $totalAdvertised = $member->getAdvertisedCountTotal();
             $result .= "Member: " . $member->getNum() . "\n";
             $result .= "Advertised count: " . $totalAdvertised . "\n";
             if ($totalAdvertised === 0) {
                 MailHelper::sendFeeReminder($member);
                 MailHelper::sendFeeReminderReferrer($member->getReferrerMember(), $member);
             } else {
                 MailHelper::sendFeeReminderWithAdvertisings($member);
                 MailHelper::sendFeeReminderWithAdvertisingsReferrer($member->getReferrerMember(), $member);
             }
             $data = $member->getMemberData();
             if (!$data) {
                 $data = new \MemberData();
                 $data->setMemberId($member->getId());
             }
             $data->setFeeReminderEmail(1);
             $data->save($con);
             $result .= "---------\n\n";
         }
         if (!$con->commit()) {
             throw new \Exception('Could not commit transaction');
         }
     } catch (\Exception $e) {
         $con->rollBack();
         throw $e;
     }
     return $result;
 }
 public function postForgotPassword()
 {
     $email = Input::get('email');
     $user = User::where('email', $email)->first();
     if (is_object($user) && count($user) > 0) {
         $password = BRMHelper::genRandomPassword();
         $user->password = $password;
         $user->updateUniques();
         //send new password to user
         MailHelper::forgotPasswordMessage($user->email, $password);
         Session::flash('notice', 'Success! New password coming your way. Please check your email.');
         return View::make('public.forgot_password');
     } else {
         Session::flash('alert', 'Sorry, <strong>' . $email . '</strong> has no associated account yet.');
         return View::make('public.forgot_password');
     }
 }
Beispiel #15
0
 protected function notifyAdmin($offenderID)
 {
     $offender = UserInfo::getByID($offenderID);
     $ue = new \Concrete\Core\User\Event\UserInfo($offender);
     Events::dispatch('on_private_message_over_limit', $ue);
     $admin = UserInfo::getByID(USER_SUPER_ID);
     Log::addEntry(t("User: %s has tried to send more than %s private messages within %s minutes", $offender->getUserName(), \Config::get('concrete.user.private_messages.throttle_max'), \Config::get('concrete.user.private_messages.throttle_max_timespan')), t('warning'));
     Loader::helper('mail');
     $mh = new MailHelper();
     $mh->addParameter('offenderUname', $offender->getUserName());
     $mh->addParameter('profileURL', BASE_URL . View::url('/profile', 'view', $offender->getUserID()));
     $mh->addParameter('profilePreferencesURL', BASE_URL . View::url('/profile/edit'));
     $mh->to($admin->getUserEmail());
     $mh->load('private_message_admin_warning');
     $mh->sendMail();
 }
 public function onReceivedMemberFee(\Member $member, \Member $referrer, $currency, $when, $freeFromInvitation, \PropelPDO $con)
 {
     // TODO - replace config value with real received value from bank transaction
     $memberFee = new \Tbmt\MemberFee(\Tbmt\Config::get('member_fee'), $member, $currency);
     // @see resources/snowball.txt - processes - P2
     if (!$freeFromInvitation) {
         $this->payAdvertisingFor($referrer, $memberFee, $member, $currency, $when, $con);
     }
     $this->updateTreeByFundsLevel($referrer, $member);
     $newAdvertisedCount = $referrer->convertOutstandingAdvertisedCount(1);
     if ($newAdvertisedCount == self::FUNDS_LEVEL_UPDATE_WITH) {
         $referrer->setFundsLevel(\Member::FUNDS_LEVEL2);
         $referrer->setMemberRelatedByParentId(null);
         MailHelper::sendFundsLevelUpgrade($referrer, $member);
     }
     $referrer->save($con);
     if (!$freeFromInvitation) {
         $memberFee->checkRemainGreaterZero();
         $memberFee->addRemainingToAccounts($when, $con);
     }
 }
 private function getMail($name)
 {
     switch ($name) {
         case 'FundsLevelUpgrade':
             return MailHelper::sendFundsLevelUpgrade(\Member::getByNum('102'), \Member::getByNum('105'));
         case 'FeeIncomeReferrer':
             return MailHelper::sendFeeIncomeReferrer(\Member::getByNum('102'), \Member::getByNum('105'));
         case 'FeeIncome':
             $member102 = \Member::getByNum('102');
             $member102->setReferrerId(\Member::getByNum('105')->getId());
             // Do not save!!
             return MailHelper::sendFeeIncome($member102);
         case 'FreeSignupConfirm':
             $member102 = \Member::getByNum('102');
             $member102->setReferrerId(\Member::getByNum('105')->getId());
             // Do not save!!
             return MailHelper::sendFreeSignupConfirm($member102);
         case 'NewFreeRecruitmentCongrats':
             return MailHelper::sendNewFreeRecruitmentCongrats(\Member::getByNum('102'), \Member::getByNum('105'));
     }
 }
 public function registerByAdmin()
 {
     $this->formAfterCheck();
     if (!$this->hasErrors()) {
         $user = new Users('create');
         $user->username = $this->username;
         $user->email = $this->email;
         $user->password = CPasswordHelper::hashPassword($this->password);
         $user->email_verified = intval($this->verified);
         if ($user->save()) {
             MailHelper::sendUserCredentials($this->username, $this->email, $this->password);
             if (!$this->verified) {
                 $url_maintenance = $user->getMaintenanceUrl();
                 $user->save();
                 MailHelper::sendRegisterConfirmMail($user->username, $user->email, $url_maintenance);
             }
             ListingNames::model()->getUserIgnoreList($user->id);
             return true;
         } else {
             $this->addErrors($user->getErrors());
         }
     }
     return false;
 }
Beispiel #19
0
 /**
  * The main send of one letter to one or mode recipients.
  * The mail content generates for each user
  *
  * TODO: Need to refactor it all to:
  * sendNewsletterToSubscriber($nid, $sid, $options)
  * sentNewsletterToEmail($nid, array $emailAndName, $options)
  * sentLetterToEmail(array $letterData, array $emailAndName, $options)
  * 
  * @param  array $params newsletter_id, subscriber(object), type ('html'|'plain'), tracking(bool)
  *
  * @return object
  * @since  1.0
  */
 public function send($params = null)
 {
     // load letter to send....
     if (empty($params['newsletter_id'])) {
         $msg = 'Newsletter id is absent. There is nothing to send.';
         $this->setError($msg);
         throw new Exception($msg);
     }
     if (empty($params['subscriber'])) {
         $msg = 'Subscriber is absent. There is no one to send.';
         $this->setError($msg);
         throw new Exception($msg);
     }
     if (empty($params['tracking'])) {
         $params['tracking'] = false;
     }
     // Load newsletter...
     $letter = JModel::getInstance('Newsletter', 'NewsletterModelEntity');
     if (!$letter->load($params['newsletter_id'])) {
         $msg = 'Loading letter error or newsletter_id is not defined. Id:' . $params['newsletter_id'];
         $this->setError($msg);
         throw new Exception($msg);
     }
     // Load newsletter's SMTP profile...
     $smtpProfile = JModel::getInstance('Smtpprofile', 'NewsletterModelEntity');
     if (!$smtpProfile->load($letter->smtp_profile_id)) {
         $msg = 'Cant load SMTP profile with id: ' . $letter->smtp_profile_id;
         $this->setError($msg);
         throw new Exception($msg);
     }
     // Load mailbox profile bound to loaded SMTP profile...
     $mailboxProfile = JModel::getInstance('Mailboxprofile', 'NewsletterModelEntity');
     if (!$mailboxProfile->load($smtpProfile->mailbox_profile_id)) {
         LogHelper::addWarning('COM_NEWSLETTER_CANT_LOAD_MAILBOX_CANT_SET_SOME_HEADERS', LogHelper::CAT_MAILER, array('Mailbox profile id' => $smtpProfile->mailbox_profile_id, 'SMTP profile' => $smtpProfile->smtp_profile_name));
     }
     // Now we have newsletter, subscriber, SMTP profile and, probably, Mailbox profile.
     // So we can start to send...
     // Use the phpMailer exceptions
     $sender = new MigurMailerSender(array('exceptions' => true));
     $subscriber = $params['subscriber'];
     $type = MailHelper::filterType(!empty($params['type']) ? $params['type'] : null);
     if (!$type) {
         $msg = 'The type "' . $type . '" is not supported';
         $this->setError($msg);
         throw new Exception($msg);
     }
     // emulate user environment
     SubscriberHelper::saveRealUser();
     if (!SubscriberHelper::emulateUser(array('email' => $subscriber->email))) {
         $msg = 'The user "' . $subscriber->email . '" is absent';
         $this->setError($msg);
         throw new Exception($msg);
     }
     PlaceholderHelper::setPlaceholder('newsletter id', $letter->newsletter_id);
     // render the content of letter for each user
     $letter->content = $this->render(array('type' => $type, 'newsletter_id' => $letter->newsletter_id, 'tracking' => true));
     $letter->subject = $this->renderSubject($letter->subject);
     $letter->encoding = $letter->params->encoding;
     SubscriberHelper::restoreRealUser();
     // Result object
     $res = new StdClass();
     $res->state = false;
     $res->errors = array();
     $res->content = $letter->content;
     if ($letter->content === false) {
         return $res;
     }
     // Add custom headers
     // Set the email to bounce
     if (!empty($mailboxProfile->username)) {
         $sender->AddCustomHeader('Return-Path:' . $mailboxProfile->username);
         $sender->AddCustomHeader('Return-Receipt-To:' . $mailboxProfile->username);
         $sender->AddCustomHeader('Errors-To:' . $mailboxProfile->username);
     }
     // Add info about newsleerter and subscriber
     $sender->AddCustomHeader(MailHelper::APPLICATION_HEADER);
     $sender->AddCustomHeader(MailHelper::EMAIL_NAME_HEADER . ':' . $letter->name);
     $sender->AddCustomHeader(MailHelper::NEWSLETTER_ID_HEADER . ':' . $params['newsletter_id']);
     $sender->AddCustomHeader(MailHelper::SUBSCRIBER_ID_HEADER . ':' . $subscriber->subscriber_id);
     // Get attachments
     $atts = DownloadHelper::getByNewsletterId($params['newsletter_id']);
     if (!$smtpProfile->isJoomlaProfile()) {
         $fromName = $smtpProfile->from_name;
         $fromEmail = $smtpProfile->from_email;
         $toName = $smtpProfile->reply_to_name;
         $toEmail = $smtpProfile->reply_to_email;
     } else {
         $jConfig = new JConfig();
         $fromName = isset($letter->params->from_name) ? $letter->params->from_name : $jConfig->fromname;
         $fromEmail = isset($letter->params->from_email) ? $letter->params->from_email : $jConfig->mailfrom;
         $toName = isset($letter->params->to_name) ? $letter->params->to_name : $jConfig->fromname;
         $toEmail = isset($letter->params->to_email) ? $letter->params->to_email : $jConfig->mailfrom;
     }
     // Check if we dan determine all parameters...
     if (empty($fromName) || empty($fromEmail) || empty($toName) || empty($toEmail)) {
         LogHelper::addWarning('COM_NEWSLETTER_MAILER_CANT_DETERMINE SOME FROMTO', LogHelper::CAT_MAILER, array('From name' => $fromName, 'From email' => $fromEmail, 'Reply to name' => $toName, 'Reply to email' => $toEmail, 'SMTP profile' => $smtpProfile->smtp_profile_name, 'Newsletter' => $letter->name));
     }
     try {
         // send the unique letter to each recipient
         $sendRes = $sender->send(array('letter' => $letter->toObject(), 'attach' => $atts, 'emails' => array($subscriber), 'smtpProfile' => $smtpProfile->toObject(), 'fromName' => $fromName, 'fromEmail' => $fromEmail, 'toName' => $toName, 'toEmail' => $toEmail, 'type' => $type, 'tracking' => $params['tracking']));
         // If sending failed
         if (!$sendRes && !empty($sender->ErrorInfo)) {
             throw new Exception($sender->ErrorInfo);
         }
     } catch (Exception $e) {
         $error = JError::getError('unset');
         if (!empty($error)) {
             $msg = $error->get('message');
             $this->setError($msg);
             $res->errors[] = $msg;
         }
         $res->errors[] = $e->getMessage();
         LogHelper::addError('COM_NEWSLETTER_MAILER_SEND_ERROR', LogHelper::CAT_MAILER, array('Error' => $e->getMessage(), 'Email' => $subscriber->email, 'Mail type' => $type, 'SMTP profile' => $smtpProfile->smtp_profile_name, 'Newsletter' => $letter->name));
         return $res;
     }
     $res->state = true;
     return $res;
 }
 public function actionDelete()
 {
     if ($this->access > UserAccessTable::FULL_ACCESS) {
         return 0;
     }
     $id = $_POST['id'];
     $calendarModel = new Calendar();
     $calendarModel = $calendarModel->findByPk($id);
     if ($calendarModel == null || $calendarModel == false) {
         echo json_encode(array('result' => 0));
         die;
     }
     $usersEmail = array();
     if (YII::app()->request->getParam('notification', 0) == 1 || YII::app()->request->getParam('notification', 0) == true) {
         $links = $this->getPropertyMembers();
         foreach ($links as $key => $link) {
             array_push($usersEmail, $link['user']['email']);
         }
     }
     $attrs = $calendarModel->attributes;
     $result = $calendarModel->deleteByPk($id);
     $date1 = new DateTime();
     $end_date = date(strtotime($calendarModel->attributes['end_date']));
     $date1->setTimestamp($end_date);
     $real_end_date = $date1->modify('-1 day');
     $end_date1 = $real_end_date->format('F d, Y');
     if ($result == 1 || $result == true) {
         $this->layout = "emailmaster";
         $body = $this->render('../emails/emailCalendar', array('fullname' => Yii::app()->user->getState('firstname') . ' ' . Yii::app()->user->getState('lastname'), 'property' => $this->propertyName, 'start' => date('F d, Y', strtotime($attrs['create_date'])), 'end' => $end_date1, 'event' => $attrs['event'], 'message' => $attrs['notes'], 'action' => 'Deleted'), true);
         MailHelper::send($body, "SharedKey.com - " . $this->propertyName . " - Deleted  Calendar Event", $usersEmail);
     }
     echo json_encode(array('result' => $result));
     die;
 }
if (!empty($user)) {
    completeInstallation('warning', 'Admin already created');
}
$model = new UserForm('create_admin');
$model->username = '******';
if (isset($_POST['UserForm'])) {
    $model->attributes = $_POST['UserForm'];
    if ($model->validate()) {
        $user = new Users();
        $user->id = 1;
        $user->username = $model->username;
        $user->password = CPasswordHelper::hashPassword($model->password);
        $user->email = $model->email;
        $user->email_verified = 1;
        if ($user->save()) {
            MailHelper::sendUserCredentials($model->username, $model->email, $model->password);
            completeInstallation('success', 'Admin user successfully created');
        }
    }
}
?>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Installation</title>

    <link rel="stylesheet" type="text/css" href="<?php 
echo Bootstrap::getBooster()->getAssetsUrl();
?>
Beispiel #22
0
<?php

include '../tests/testenv.php';
/*
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Carpool</title>
</head>
<body>
<?php 
*/
//$rides = DatabaseHelper::getInstance()->searchRides(array());
//echo MailHelper::render(VIEWS_PATH . '/showInterestMail.php', array('rides' => $rides));
$contact = DatabaseHelper::getInstance()->getContactById(1);
echo MailHelper::render(VIEWS_PATH . '/registrationMail.php', array('contact' => $contact));
		protected function notifyAdmin($offenderID) {
			$offender = UserInfo::getByID($offenderID);
			Events::fire('on_private_message_over_limit', $offender);
			$admin = UserInfo::getByID(USER_SUPER_ID);
			
			Log::addEntry(t("User: %s has tried to send more than %s private messages within %s minutes", $offender->getUserName(), USER_PRIVATE_MESSAGE_MAX, USER_PRIVATE_MESSAGE_MAX_TIME_SPAN),t('warning'));
			
			Loader::helper('mail');
			$mh = new MailHelper();
			
			$mh->addParameter('offenderUname', $offender->getUserName());
			$mh->addParameter('profileURL', BASE_URL . View::url('/profile', 'view', $offender->getUserID()));
			$mh->addParameter('profilePreferencesURL', BASE_URL . View::url('/profile/edit'));
			
			$mh->to($admin->getUserEmail());
			$mh->load('private_message_admin_warning');
			$mh->sendMail();
		}
Beispiel #24
0
 public function sendRecoverInstructions()
 {
     $session = new SessionHelper();
     $mail = new MailHelper();
     $formval = new FormHelper();
     $usermodel = new UserModel();
     // Form validation
     // Email
     $email = $formval->testInput($_POST['email']);
     // Set the recoverid in the DB
     if ($usermodel->setRecoverLink($email)) {
         // Send the link to the user
         // recoverid is now in $_SESSION['recoverid']
         $mail->sendRecoverMail($email);
         $session->setMessage('We have just send the link', 4);
         redirectTo(BASE_URL . 'index.php?c=user&a=viewrecoverpassword');
     } else {
         $session->setMessage('E-mail address is unknown to us.', 3);
         redirectTo(BASE_URL . 'index.php?c=user&a=viewrecoverpassword');
     }
 }
Beispiel #25
0
 public function actionRemoveproperty($id)
 {
     $userId = Yii::app()->user->getState('id');
     //all users can remove itself from property member's list
     if (!UserAccessTable::checkUser2PropertyAccess($userId, $id, UserAccessTable::GUEST)) {
         Yii::app()->request->redirect(basePath('app/gallery'));
     }
     $user2property = User2property::model()->findByAttributes(array('userId' => $userId, 'propertyId' => $id));
     if ($user2property->getAttribute('access') != UserAccessTable::OWNER) {
         //email to member (NOT admin)
         $this->layout = "emailmaster";
         $body = $this->render("../emails/emailItselfRemove", array('name' => $user2property->user->getAttribute('firstname') . ' ' . $user2property->user->getAttribute('lastname'), 'propertyName' => $user2property->property->getAttribute('property_name')), true);
         MailHelper::send($body, "SharedKey - Removed Property", array($user2property->user->getAttribute('email')));
         //clear calendar events first
         $calendar = new Calendar();
         $calendar = $calendar->findAllByAttributes(array('linkid' => $user2property->getAttribute('id')));
         foreach ($calendar as $cal) {
             $cal->delete();
         }
         //for not property Administrator we just remove a link to property
         $user2property->delete();
         if ($this->_isAllUserPropertiesDeactivated($userId)) {
             //removed last property need remove user
             $this->removeUser($userId);
             return;
         }
         Yii::app()->request->redirect(basePath('app/properties'));
         return;
     }
     //member is administrator we need cancel RecurringPaymentsProfile and deactivate property
     //lets find last transaction
     $transaction = Transaction::model()->findByAttributes(array('userid' => $userId, 'propertyid' => $id));
     if (!$transaction) {
         //no previous transactions not need to refund
     }
     $userApi = sharedkeyApi::create('usersAPI');
     $userEmail = Yii::app()->user->getState('email');
     $userApi->addParams(array('email' => $userEmail));
     $byEmail = json_decode($userApi->byEmail('get'));
     $userData = (array) $byEmail->data;
     $userData['property_id'] = $id;
     //close RecurringPaymentsProfile
     if ($transaction) {
         YII::app()->user->setState("addPropertyEmailed", true);
         $temp = PayPalHelper::cancelRecurringPaymentsProfile($transaction->getAttribute('pp_PROFILEID'), $userData);
     }
     //do deactivated
     $property = Properties::model()->findByPk($id);
     $property->isdeactivated = 1;
     $property->edt = new CDbExpression('NOW()');
     //$property->trialPeriodStartDate = null;
     $property->save();
     $this->layout = "emailmaster";
     //mail to admin
     $token = uniqid();
     $body = $this->render("../emails/emailAdminAfterRemove", array('name' => Yii::app()->user->getState('firstname') . ' ' . Yii::app()->user->getState('lastname'), 'propertyName' => $property->getAttribute('property_name'), 'url' => basePathByHost("/app/changeactiveproperty/" . $property->getAttribute("id")) . '?token=' . $token), true);
     MailHelper::send($body, "SharedKey - Removed Property", array($userEmail));
     //informative other user about property deactivated
     $users2properties = User2property::model()->with('user')->findAll('propertyId=:propertyId', array(':propertyId' => $id));
     foreach ($users2properties as $key => $u2p) {
         if ($u2p->getAttribute('access') == UserAccessTable::OWNER) {
             continue;
         }
     }
     if ($this->_isAllUserPropertiesDeactivated($userId)) {
         $user = User::model()->find('id=:id', array(':id' => $userId));
         $user->verificationToken = $token;
         $user->save();
         $this->redirect(basePath('user/logout'));
         return;
     }
     Yii::app()->request->redirect(basePath('app/properties'));
 }
Beispiel #26
0
 /**
  * Get the template
  *
  * @return	string	The template name
  * @since	1.0
  */
 public function loadLetter($id = false)
 {
     $letter = MailHelper::loadLetter($id);
     // set the letter id for the Helper
     MigurModuleHelper::$itemId = $letter->newsletter_id;
     MigurModuleHelper::$clean = null;
     return $letter;
 }
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
    Log::error($exception);
    $user = Auth::check() ? json_encode(Auth::user()) : 'no user';
    $visitor_ip = Request::getClientIp();
    $message = "Code: {$code}\n\nIP: {$visitor_ip}\n\nURL: " . Request::url() . "\n\nUser: {$user}\nInput: " . json_encode(Input::all()) . "\n\nexception: {$exception}";
    Log::error($exception);
    MailHelper::sendEmailPlain(['email' => Config::get('mail.admin_email'), 'subject' => "Exception code {$code}", 'text' => $message]);
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/*
Beispiel #28
0
<?php

include "env.php";
include APP_PATH . "/Bootstrap.php";
$feedbackOptions = array(1 => _("Report a bug"), 2 => _("Ask a question"), 3 => _("Request a feature"), 4 => _("Contact"), 5 => _("Other"));
// This is a post - form submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (!AuthHandler::isSessionExisting()) {
        // Try to discard bots by dropping requests with no session
        die;
    }
    extract($_POST);
    if (!Utils::isEmptyString($feedback)) {
        $mailHelper = new MailHelper();
        $wantToStr = isset($wantTo) && isset($feedbackOptions[$wantTo]) ? $feedbackOptions[$wantTo] : _("Other");
        $params = array('wantTo' => $wantToStr, 'feedback' => $feedback, 'email' => $email);
        $body = $mailHelper->render('views/feedbackMail.php', $params);
        $to = getConfiguration('feedback.mail');
        $toName = getConfiguration('feedback.to.name');
        $from = getConfiguration('feedback.from');
        $fromName = getConfiguration('feedback.from.name');
        $replyTo = Utils::isEmptyString($email) ? null : Utils::buildEmail($email);
        Utils::sendMail($to, $toName, $from, 'Carpool feedback', 'New carpool feedback', $body, $replyTo, $replyTo);
        GlobalMessage::setGlobalMessage(_('Thanks for the feedback!'));
    } else {
        GlobalMessage::setGlobalMessage(_('Please write something.'), GlobalMessage::ERROR);
    }
    // Get after post
    Utils::redirect('feedback.php');
} else {
    AuthHandler::putUserToken();
Beispiel #29
0
 /**
  * メールフォームプラグインのフォームへのリンクを生成する
  * 
  * @param string $title リンクのタイトル
  * @param string $contentsName メールフォームのコンテンツ名
  * @param array $datas メールフォームに引き継ぐデータ(初期値 : array())
  * @param array $options a タグの属性(初期値 : array())
  *	※ オプションについては、HtmlHelper::link() を参照
  * @return void
  */
 public function mailFormLink($title, $contentsName, $datas = array(), $options = array())
 {
     App::uses('MailHelper', 'Mail.View/Helper');
     $MailHelper = new MailHelper($this->_View);
     $MailHelper->link($title, $contentsName, $datas, $options);
 }
<?php

$msg = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $to = $_POST['to'];
    $from = $_POST['from'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $helper = new MailHelper();
    try {
        $helper->sendEmail($to, $from, $subject, $message, '*****@*****.**', 'huychaudn');
        $msg = "Gửi thành công!";
    } catch (Exception $exc) {
        $msg = $exc->getMessage();
    }
}