Ejemplo n.º 1
0
    /** Send en bestemt artikkel på e-post */
    protected function send_email($row)
    {
        $this->email->text('Hei,

Siden du ikke lengre er med i avisfirmaet "' . $row['ff_name'] . '" har din artikkel blitt slettet fordi den ikke tilhørte noen utgivelse. I tilfelle du kanskje ønsker å beholde teksten fra artikkelen, sender vi den på e-post.

Avisfirma: ' . $row['ff_name'] . ' <' . ess::$s['path'] . '/ff/?ff_id=' . $row['ff_id'] . '>

Tittel: ' . $row['ffna_title'] . '
Opprettet: ' . ess::$b->date->get($row['ffna_created_time'])->format(date::FORMAT_SEC) . ($row['ffna_updated_time'] ? '
Sist oppdatert: ' . ess::$b->date->get($row['ffna_updated_time'])->format(date::FORMAT_SEC) : '') . ($row['ffna_published'] ? '
Publisert: ' . ess::$b->date->get($row['ffna_published_time'])->format(date::FORMAT_SEC) : '') . '
Pris: ' . game::format_cash($row['ffna_price']) . '

Innhold:

-- START --
' . $row['ffna_text'] . '
-- SLUTT --

--
Kofradia.no
Denne e-posten er sendt til ' . $row['u_email'] . ' som ' . ($row['up_access_level'] == 0 ? 'tidligere tilhørte' : 'tilhører') . ' ' . $row['up_name'] . '
' . ess::$s['path']);
        $this->email->format();
        mailer::add_emails($this->email, $row['u_email'], "Din tidligere artikkel: {$row['ffna_title']} - Kofradia", true);
        putlog("CREWCHAN", "AVISARTIKKEL SLETTET: E-post planlagt for utsendelse. %c4Mailer scriptet må kjøres!");
    }
Ejemplo n.º 2
0
 public static function ListUpdatedSendMessages()
 {
     $tweetprivate = new tweet();
     $tweetprivate->sendWatchlistUpdate();
     $updateEmail = new email(email::ADDRESSES_ALL_CHOSEN);
     $updateEmail->sendWatchlistUpdate();
 }
Ejemplo n.º 3
0
 /**
  * @param \CentralNews\Service\Subscriber|email $subscriber
  * @param \CentralNews\Entity\ISubscriberGroup $group
  * @return bool
  */
 public function deleteSubscriber($subscriber, ISubscriberGroup $group)
 {
     $email = $subscriber instanceof Subscriber ? $subscriber->getEmail() : $subscriber;
     $param = array('group_id' => $group->getId(), 'subscriber_email' => $email);
     $request = new Request('delete_subscriber', $param, '', '');
     $response = $this->sendRequest($request);
     return $response->isSuccess();
 }
Ejemplo n.º 4
0
 public function send_password_link($user, $key)
 {
     $message = file_get_contents("../extra/reset_password.txt");
     $replace = array("FULLNAME" => $user["fullname"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "KEY" => $key);
     $email = new email("Reset password at " . $_SERVER["SERVER_NAME"], $this->settings->webmaster_email);
     $email->set_message_fields($replace);
     $email->message($message);
     $email->send($user["email"], $user["fullname"]);
 }
Ejemplo n.º 5
0
 public function sendEmailChangeMailAdmin($newEmail)
 {
     $to = ADMIN_EMAIL;
     $subject = 'AI Club - Email Changed';
     $arrData['{EMAIL}'] = $newEmail;
     $objEmail = new email();
     $EmailBody = $objEmail->emailTemplate('member_email_changed_admin', $arrData);
     $objEmail->sendmail($to, $subject, $EmailBody);
 }
Ejemplo n.º 6
0
function enviaremail($para, $blank, $titulo, $texto)
{
    global $email_from, $email_from_name, $email_smtp, $email_pass, $email_user, $email_auth, $email_debug, $email_replay;
    if (strlen($email_from) == 0) {
        echo '<H1>Erro #120#</h1>';
        echo '<PRE>';
        echo 'Parametros nao informados:
			/* Dados do enviador */
			$email_from = \'\';			/* e-mail do enviador / replay */
			$email_from_name = \'\';	/* Nome do enviador */
			
			/* Tipo de envio */
			$email_auth = \'\'; 			/* ou AUTH ou MAIL */
			
			/* Dados da conta do enviador - obrigatorio para AUTH */
			$email_smtp = \'\';			/* servidor de SMTP */
			$email_user = \'\';			/* usuario da conta do enviador */
			$email_pass = \'\';			/* senha da conta do enviador */	
			
			';
        echo '</pre>';
        exit;
    }
    switch ($email_auth) {
        case 'AUTH':
            $mail = new email();
            $mail->titulo = $titulo;
            $mail->texto = $texto;
            $mail->email = $email_from;
            $mail->email_replay = $email_replay;
            $mail->email_name = $email_from_name;
            $mail->email_user = $email_user;
            $mail->email_pass = $email_pass;
            $mail->email_smtp = $email_smtp;
            $mail->debug = round($email_debug);
            $mail->to = $para;
            $mail->method_2_mail();
            break;
        default:
            $mail = new email();
            $mail->titulo = $titulo;
            $mail->texto = $texto;
            $mail->email = $email_from;
            $mail->email_replay = $email_replay;
            $mail->email_name = $email_from_name;
            $mail->email_user = $email_user;
            $mail->email_pass = $email_pass;
            $mail->email_smtp = $email_smtp;
            $mail->debug = round($email_debug);
            $mail->to = $para;
            $mail->method_1_mail();
            break;
    }
}
Ejemplo n.º 7
0
 function send($affiliate_newsletter_id)
 {
     $mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: osCmax Mailer'));
     $mimemessage->add_text($this->content);
     $mimemessage->build_message();
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['affiliate_firstname'] . ' ' . $mail['affiliate_lastname'], $mail['affiliate_email_address'], '', EMAIL_FROM, $this->title);
     }
     $affiliate_newsletter_id = tep_db_prepare_input($affiliate_newsletter_id);
     tep_db_query("update " . TABLE_AFFILIATE_NEWSLETTERS . " set date_sent = now(), status = '1' where affiliate_newsletters_id = '" . tep_db_input($affiliate_newsletter_id) . "'");
 }
Ejemplo n.º 8
0
 public function sendPasswordChangedEmail1($row)
 {
     global $objComm, $DB;
     $to = ADMIN_EMAIL;
     $subject = 'AI Club - Password Change‏‏d';
     $arrData['{NAME}'] = $row->fname;
     $arrData['{EMAIL}'] = $row->email_address;
     $arrData['{BIRTHDATE}'] = $row->birth_date;
     $objEmail = new email();
     $EmailBody = $objEmail->emailTemplate('new_password_changed', $arrData);
     $objEmail->sendmail($to, $subject, $EmailBody);
 }
Ejemplo n.º 9
0
 function send($newsletter_id)
 {
     $mail_query = smn_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: oscMall bulk mailer'));
     $mimemessage->add_html($this->content);
     $mimemessage->build_message();
     while ($mail = smn_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = smn_db_prepare_input($newsletter_id);
     smn_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . smn_db_input($newsletter_id) . "'");
 }
 public function sendmail()
 {
     $to = $this->row->email_address;
     //$to 	 = '*****@*****.**';
     $subject = 'AI Club - Your Memeber account created successfully';
     $arrData['{FIRST_NAME}'] = $this->row->fname;
     $arrData['{EMAIL}'] = $this->row->email_address;
     $arrData['{PASSWORD}'] = $_REQUEST['data_password'];
     $arrData['{URL}'] = SITE_PATH . "/index.php";
     $objEmail = new email();
     $EmailBody = $objEmail->emailTemplate('member_login', $arrData);
     $objEmail->sendmail($to, $subject, $EmailBody);
 }
Ejemplo n.º 11
0
 function send($newsletter_id)
 {
     $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
         // Préparation de l'envoie du mail en HTML
         $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);
         $mimemessage->build_message();
         // ################# END - Contribution Newsletter v050 ##############
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
Ejemplo n.º 12
0
function sendRespuesta()
{
    $destino = new usuario($_POST["usr_id"]);
    $correo = new email();
    $link_detalle = FULL_WEBPAGE . '/detalle.php?id=' . $_POST["pub_id"];
    $link_respuesta = FULL_WEBPAGE . '/preguntas.php?tipo=2&publicacion=' . $_POST["pub_id"];
    $links = array("detalle" => $link_detalle, "respuesta" => $link_respuesta);
    $correo->sendRespuesta($destino->a_email, $links, $_POST['respuesta']);
    /*
    		$cli = new usuario($_POST["usr_id"]);
    		$poster = new usuario($_POST["id_poster"]);
    		$publicacion = new publicaciones($_POST["pub_id"]);
    		ini_set("sendmail_from",$poster->a_email);
    		$email_to = "" . $cli-> a_email . "";
    
    		$email_subject = "Apreciodepana.com "." -  ".$poster-> n_nombre." ".$poster->n_apellido." ha contestado tu pregunta!";
    		$email_message = "Sobre la publicacion:  ".$publicacion -> titulo." \n\n ".$_POST['respuesta'];	
    		
    		$txt = '<!DOCTYPE html>
          <html lang="es"><body>
    		<div style=" padding 20px; text-align:left; margin: 20px;">
    		<div style="width:500px;background:#fff; color:#666; padding:20px; margin-left:30px; margin-right:30px;">
    		<div style="text-align:left; padding-bottom:10px; border-bottom: 1px solid #CCC;"><img src="http://vogueseshop.com/galeria/img/logos/logo-header2.png"></div>
    		<br>';	
    		
    		
    		$txt .= " <div style='text-align:left; margin-left:10px; 	font-size: 18px; '>
    		               <p><b>Te han respondido!</b></p>
    		               <p>Te respondieron una pregunta sobre la siguiente publicaci&oacute;n</p>
    		                <a style='text-decoration:none;'><p>$link_detalle</p><a>
    		            </div>
    		            <br>		
    		            <div style='text-align:left; padding-bottom:10px; border-bottom: 1px solid #ccc;' >
    		               <a href=$link_respuesta style='text-decoration:none;'>
    		               <button style='background:#36A7E1;
    		                  text-align:center;  color:#FFF; padding:10px; margin:10px; border: 1px solid #1e8dc6; cursor: pointer; font-size: 18px;'>Ver Respuesta</button>
    		               </a> ";	
    		
    		$txt .= '<br></div><div style="font-size: 12px; text-align:left; margin-left:10px; color:#999;  margin-top:5px;">
    			Vistete a la moda con la mejor tecnologia </div></div></div></body></html>';
    		//$headers = 'From: Apreciodepana.com ' . "\r\n" . 'Reply-To: ' . "*****@*****.**" . "\r\n" . 'X-Mailer: PHP/' . phpversion ();
    		$headers = 'From: Vogues Eshop <*****@*****.**> \r\n' . 'Reply-To: '  . "*****@*****.**" . "\r\n" . 'X-Mailer: PHP/' . phpversion ()." MIME-Version: 1.0\r\n"." Content-type: text/html; charset=UTF-8.";
    		
    		mail ( $email_to, 'vogueseshop.com', $txt, $headers );
    		//echo json_encode(array("estado"=>"OK"));
    		echo json_encode(array("correo a enviar"=>$cli-> a_email, "correo from"=>$poster->a_email,"header"=>$headers,"subject"=>$email_subject,"message"=>$email_message));		
    
    * 
    */
}
Ejemplo n.º 13
0
 public function callback($row)
 {
     $memObj = new \Memcached();
     foreach ($row as $value) {
         //更新缓存
         $key = 'user_' . $value['uid'];
         $memObj->set($key, json_encode($value));
         //给用户发站内信等
         $emailObj = new email();
         $emailObj->send($value['uid']);
         //.....
         //anything
     }
 }
Ejemplo n.º 14
0
 /**
  * Methode : page envoyer le mailing
  */
 public function envoyer()
 {
     if ($_POST) {
         $texte = $this->input->post('texte');
         $format = $this->input->post('format');
         $sujet = $this->input->post('sujet');
         $format = $format == 1 ? TRUE : FALSE;
         $users = $this->user->select();
         $nbr_envois = 0;
         foreach ($users as $user) {
             if ($format) {
                 $view = new View('mailing/template');
                 $view->name = ucfirst(mb_strtolower($user->username));
                 $view->content = $texte;
                 $message = $view->render();
             } else {
                 $message = $texte;
             }
             if (email::send($user->email, Kohana::config('email.from'), $sujet, $message, $format)) {
                 $nbr_envois++;
             }
         }
         return url::redirect('mailing?msg=' . urlencode(Kohana::lang('mailing.send_valide', number_format($nbr_envois))));
     } else {
         return parent::redirect_erreur('mailing');
     }
 }
Ejemplo n.º 15
0
 public function check_reorder_level()
 {
     global $db;
     global $auth_session;
     $domain_id = domain_id::get($this->domain_id);
     //sellect qty and reorder level
     $inventory = new product();
     $sth = $inventory->select_all('count');
     $inventory_all = $sth->fetchAll(PDO::FETCH_ASSOC);
     $email = "";
     foreach ($inventory_all as $row) {
         if ($row['quantity'] <= $row['reorder_level']) {
             $message = "The quantity of Product: " . $row['description'] . " is " . siLocal::number($row['quantity']) . ", which is equal to or below its reorder level of " . $row['reorder_level'];
             $return['row_' . $row['id']]['message'] = $message;
             $email_message .= $message . "<br />\n";
         }
     }
     //print_r($return);
     #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
     $email = new email();
     $email->notes = $email_message;
     $email->from = $email->get_admin_email();
     $email->to = $email->get_admin_email();
     #$email -> bcc = "justin@localhost";
     $email->subject = "Simple Invoices reorder level email";
     $email->send();
     return $return;
 }
Ejemplo n.º 16
0
 /**
  * Sends an email alert
  */
 public static function _send_email_alert($post)
 {
     // Email Alerts, Confirmation Code
     $alert_email = $post->alert_email;
     $alert_lon = $post->alert_lon;
     $alert_lat = $post->alert_lat;
     $alert_radius = $post->alert_radius;
     $alert_code = text::random('alnum', 20);
     $settings = kohana::config('settings');
     $to = $alert_email;
     $from = array();
     $from[] = $settings['alerts_email'] ? $settings['alerts_email'] : $settings['site_email'];
     $from[] = $settings['site_name'];
     $subject = $settings['site_name'] . " " . Kohana::lang('alerts.verification_email_subject');
     $message = Kohana::lang('alerts.confirm_request') . url::site() . 'alerts/verify?c=' . $alert_code . "&e=" . $alert_email;
     if (email::send($to, $from, $subject, $message, TRUE) == 1) {
         $alert = ORM::factory('alert');
         $alert->alert_type = self::EMAIL_ALERT;
         $alert->alert_recipient = $alert_email;
         $alert->alert_code = $alert_code;
         $alert->alert_lon = $alert_lon;
         $alert->alert_lat = $alert_lat;
         $alert->alert_radius = $alert_radius;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 17
0
 public static function config($config = array())
 {
     if (!is_array($config)) {
         return false;
     }
     self::$config = $config;
     self::$mail = System::load_sys_class("phpmailer");
     self::$mail->IsSMTP();
     // 启用SMTP
     self::$mail->Host = $config['stmp_host'];
     //SMTP服务器
     self::$mail->SMTPAuth = true;
     //开启SMTP认证
     self::$mail->Username = $config['user'];
     // SMTP用户名
     self::$mail->Password = $config['pass'];
     // SMTP密码
     self::$mail->From = $config['from'];
     //发件人地址
     self::$mail->FromName = $config['fromName'];
     //发件人
     self::$mail->AddReplyTo($config['from'], $config['fromName']);
     //回复地址
     self::$mail->WordWrap = 50;
     //设置每行字符长度
 }
Ejemplo n.º 18
0
 public function forgotpassword($data)
 {
     try {
         $db = new db_core();
         $token = $this->getToken('users', 'recoverToken');
         $where['email'] = $data->email;
         $in['recoverToken'] = $token;
         $info = $db->reg_one("SELECT nombre FROM users WHERE email='" . $data->email . "'");
         $db->update('users', $in, $where);
         $email = new email();
         $email->forgotmail($data->email, $token, $info[0]);
         $this->returnData(array("status" => 0));
     } catch (Exception $e) {
         $this->returnData(array("status" => 1));
     }
 }
Ejemplo n.º 19
0
 /**
  * Méthode qui crée l'unique instance de la classe
  * si elle n'existe pas encore puis la retourne.
  *
  * @param void
  * @return Singleton
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new email();
     }
     return self::$_instance;
 }
Ejemplo n.º 20
0
 /**
  * The index method is the default method called when you access this controller, so we can use this
  * to run the scheduled tasks. Takes an optional URL parameter "tasks", which is a comma separated list of
  * the module names to schedule, plus can contain "notifications" to fire the built in notifications system or
  * "all_modules" to fire every module that declares a scheduled task plugin.
  * If tasks are not specified then everything is run.
  */
 public function index()
 {
     $tm = microtime(true);
     $this->db = new Database();
     $system = new System_Model();
     if (isset($_GET['tasks'])) {
         $tasks = explode(',', $_GET['tasks']);
     } else {
         $tasks = array('notifications', 'all_modules');
     }
     // grab the time before we start, so there is no chance of a record coming in while we run that is missed.
     $currentTime = time();
     if (in_array('notifications', $tasks)) {
         $this->last_run_date = $system->getLastScheduledTaskCheck();
         $this->checkTriggers();
     }
     $tmtask = microtime(true) - $tm;
     if ($tmtask > 5) {
         self::msg("Triggers & notifications scheduled task took {$tmtask} seconds.", 'alert');
     }
     $this->runScheduledPlugins($system, $tasks);
     if (in_array('notifications', $tasks)) {
         $swift = email::connect();
         $this->doRecordOwnerNotifications($swift);
         $this->doDigestNotifications($swift);
     }
     // mark the time of the last scheduled task check, so we can get diffs next time
     $this->db->update('system', array('last_scheduled_task_check' => "'" . date('c', $currentTime) . "'"), array('id' => 1));
     self::msg("Ok!");
     $tm = microtime(true) - $tm;
     if ($tm > 30) {
         self::msg("Scheduled tasks for " . implode(', ', $tasks) . " took {$tm} seconds.", 'alert');
     }
 }
Ejemplo n.º 21
0
 public function notify_admins($subject = NULL, $message = NULL)
 {
     // Don't show the exceptions for this operation to the user. Log them
     // instead
     try {
         if ($subject && $message) {
             $settings = kohana::config('settings');
             $from = array();
             $from[] = $settings['site_email'];
             $from[] = $settings['site_name'];
             $users = ORM::factory('user')->where('notify', 1)->find_all();
             foreach ($users as $user) {
                 if ($user->has(ORM::factory('role', 'admin'))) {
                     $address = $user->email;
                     $message .= "\n\n\n\n~~~~~~~~~~~~\n" . Kohana::lang('notifications.admin_footer') . "\n" . url::base() . "\n\n" . Kohana::lang('notifications.admin_login_url') . "\n" . url::base() . "admin";
                     if (!email::send($address, $from, $subject, $message, FALSE)) {
                         Kohana::log('error', "email to {$address} could not be sent");
                     }
                 }
             }
         } else {
             Kohana::log('error', "email to {$address} could not be sent\n\t\t\t\t - Missing Subject or Message");
         }
     } catch (Exception $e) {
         Kohana::log('error', "An exception occured " . $e->__toString());
     }
 }
Ejemplo n.º 22
0
 /**
  * Sends an email alert
  *
  * @param Validation_Core $post
  * @param Alert_Model $alert
  * @return bool 
  */
 public static function _send_email_alert($post, $alert)
 {
     if (!$post instanceof Validation_Core and !$alert instanceof Alert_Model) {
         throw new Kohana_Exception('Invalid parameter types');
     }
     // Email Alerts, Confirmation Code
     $alert_email = $post->alert_email;
     $alert_code = text::random('alnum', 20);
     $settings = kohana::config('settings');
     $to = $alert_email;
     $from = array();
     $from[] = $settings['alerts_email'] ? $settings['alerts_email'] : $settings['site_email'];
     $from[] = $settings['site_name'];
     $subject = $settings['site_name'] . " " . Kohana::lang('alerts.verification_email_subject');
     $message = Kohana::lang('alerts.confirm_request') . url::site() . 'alerts/verify?c=' . $alert_code . "&e=" . $alert_email;
     if (email::send($to, $from, $subject, $message, TRUE) == 1) {
         $alert->alert_type = self::EMAIL_ALERT;
         $alert->alert_recipient = $alert_email;
         $alert->alert_code = $alert_code;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 23
0
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $html_email = false)
{
    // Instantiate a new mail object
    $message = new email(array('X-Mailer: E-goldexJp Mailer'));
    // Build the text version
    $text = strip_tags($email_text);
    // edit by donghp 27/03/2012
    if ($html_email) {
        $message->add_html($email_text, $text);
    } else {
        $message->add_text($text);
    }
    // Send message
    $message->build_message();
    $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
Ejemplo n.º 24
0
 /**
  * Send an email message.
  *
  * @param   string|array  recipient email (and name), or an array of To, Cc, Bcc names
  * @param   string|array  sender email (and name)
  * @param   string        message subject
  * @param   string        message body
  * @param   boolean       send email as HTML
  * @return  integer       number of emails sent
  */
 public static function send($to, $from, $subject, $body, $html = TRUE)
 {
     // Connect to SwiftMailer
     email::$mail === NULL and email::connect();
     // Determine the message type
     $html = $html === TRUE ? 'text/html' : 'text/plain';
     // Create the message
     $message = Swift_Message::newInstance()->setBody($body, $html)->setSubject($subject);
     if (is_string($to)) {
         // Single recipient
         $message->setTo(array($to));
     } elseif (is_array($to)) {
         //array('to', array('address' => 'name'))
         //array('to', 'address')
         foreach ($to as $method => $add) {
             switch (strtolower($method)) {
                 case 'bcc':
                     $message->setBcc($add);
                     break;
                 case 'cc':
                     $message->setCc($add);
                     break;
                     //Default method is to
                 //Default method is to
                 default:
                     $message->setTo($add);
                     break;
             }
         }
     }
     $message->setFrom($from);
     return email::$mail->send($message);
 }
Ejemplo n.º 25
0
 public function index()
 {
     $db = new Database();
     $incidents = $db->query("SELECT incident.id, incident_title, \n\t\t\t\t\t\t\t\t incident_description, incident_verified, \n\t\t\t\t\t\t\t\t location.latitude, location.longitude, alert_sent.incident_id\n\t\t\t\t\t\t\t\t FROM incident INNER JOIN location ON incident.location_id = location.id\n\t\t\t\t\t\t\t\t LEFT OUTER JOIN alert_sent ON incident.id = alert_sent.incident_id");
     $config = kohana::config('alerts');
     $sms_from = NULL;
     $settings = ORM::factory('settings', 1);
     if ($settings->loaded == true) {
         // Get SMS Numbers
         if (!empty($settings->sms_no3)) {
             $sms_from = $settings->sms_no3;
         } elseif (!empty($settings->sms_no2)) {
             $sms_from = $settings->sms_no2;
         } elseif (!empty($settings->sms_no1)) {
             $sms_from = $settings->sms_no1;
         } else {
             $sms_from = "000";
         }
         // User needs to set up an SMS number
     }
     foreach ($incidents as $incident) {
         if ($incident->incident_id != NULL) {
             continue;
         }
         $verified = (int) $incident->incident_verified;
         if ($verified) {
             $latitude = (double) $incident->latitude;
             $longitude = (double) $incident->longitude;
             $proximity = new Proximity($latitude, $longitude);
             $alertees = $this->_get_alertees($proximity);
             foreach ($alertees as $alertee) {
                 $alert_type = (int) $alertee->alert_type;
                 if ($alert_type == 1) {
                     $sms = new Eflyer();
                     $sms->user = $settings->eflyer_username;
                     $sms->password = $settings->eflyer_password;
                     $sms->use_ssl = false;
                     $sms->sms();
                     $message = $incident->incident_description;
                     if ($sms->send($alertee->alert_recipient, $message) == "OK") {
                         $db->insert('alert_sent', array('alert_id' => $alertee->id, 'incident_id' => $incident->id, 'alert_date' => date("Y-m-d H:i:s")));
                         $db->clear_cache(true);
                     }
                 } elseif ($alert_type == 2) {
                     $to = $alertee->alert_recipient;
                     $from = $config['alerts_email'];
                     $subject = $incident->incident_title;
                     $message = $incident->incident_description;
                     if (email::send($to, $from, $subject, $message, TRUE) == 1) {
                         $db->insert('alert_sent', array('alert_id' => $alertee->id, 'incident_id' => $incident->id, 'alert_date' => date("Y-m-d H:i:s")));
                         $db->clear_cache(true);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 26
0
 public function printOne($siteEmail)
 {
     $siteName = site::GET($siteEmail->siteID)->name;
     $emailName = email::GET($siteEmail->emailID)->name;
     echo "<table>";
     echo "<tr><td><b>\tСайт:\t</b></td><td><a  href=\"/site/view/{$siteEmail->siteID}\">\t{$siteName}\t</a></td></tr>";
     echo "<tr><td><b>\temail:\t</b></td><td><a href=\"/email/view/{$siteEmail->emailID}\">\t{$emailName}\t</a></td></tr>";
     echo "</table>";
 }
Ejemplo n.º 27
0
 function send($newsletter_id)
 {
     $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: osCommerce'));
     // Build the text version
     $text = strip_tags($this->content);
     if (EMAIL_USE_HTML == 'true') {
         $mimemessage->add_html($this->content, $text);
     } else {
         $mimemessage->add_text($text);
     }
     $mimemessage->build_message();
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
Ejemplo n.º 28
0
 public function GET($id)
 {
     if (!email::IFDELETED($id)) {
         $getQuery = "SELECT id, name FROM [dbo].[email] WHERE id={$id};";
         $row = mssql_fetch_array(mssql_query($getQuery));
         $result = new email($row["id"], $row["name"]);
         return $result;
     }
 }
 public function newEntry()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         email::INSERT($_POST['name']);
         header("Location: /email/view/{$id}");
     } else {
         emailController::loadView('new', $args = array());
     }
 }
Ejemplo n.º 30
0
 private function send_notification($message)
 {
     if ($this->settings->guestbook_maintainers == "") {
         return;
     }
     $maintainers = users_with_role($this->db, $this->settings->guestbook_maintainers);
     $guestbook_url = "http://" . $_SERVER["SERVER_NAME"] . "/" . $this->page->module;
     $email = new email("Guestbook message posted", $this->settings->webmaster_email);
     foreach ($maintainers as $maintainer) {
         $cms_url = "http://" . $_SERVER["SERVER_NAME"] . "/cms/guestbook";
         if (($key = one_time_key($this->db, $maintainer["id"])) !== false) {
             $cms_url .= "?login="******"<body>" . "<p>The following message has been added to the guestbook on the '" . $this->settings->head_title . "' website.</p>" . "<p>\"<i>" . $message . "</i>\"</p>" . "<p>Click <a href=\"" . $guestbook_url . "\">here</a> to visit the guestbook page or <a href=\"" . $cms_url . "\">here</a> to visit the guestbook CMS page.</p>" . "</body>";
         $email->message($message);
         $email->send($maintainer["email"], $maintainer["fullname"]);
     }
 }