コード例 #1
0
ファイル: MAILER.PHP プロジェクト: pauEscarcia/AIMM
	function send(){
            if(!empty($this->sendHTML)){
                $this->AltBody = $this->textVersion($this->Body,true);
            }else{
                $this->Body = $this->textVersion($this->Body,false);
            }


            if(empty($this->ReplyTo)){
                    $replyToName = $this->config->getValue('replyto_name');
                    $this->AddReplyTo($this->config->getValue('replyto_email'),$replyToName);
            }

           //Embed images if there is images to embed...
            if((bool)$this->config->getValue('embed_images',0) && !$this->isElasticRest && !$this->isSendGridRest){
                    $this->embedImages();
            }
            if(empty($this->Subject) OR empty($this->Body)){
                    $this->reportMessage = __('There is no subject or body in this email',WYSIJA);
                    $this->errorNumber = 8;
                    return false;
            }
            if(function_exists('mb_convert_encoding') && !empty($this->sendHTML)){
                    $this->Body = mb_convert_encoding($this->Body,'HTML-ENTITIES','UTF-8');
                    $this->Body = str_replace('&','&',$this->Body);
            }
            if($this->CharSet != 'utf-8'){
                    $this->Body = $this->encodingHelper->change($this->Body,'UTF-8',$this->CharSet);
                    $this->Subject = $this->encodingHelper->change($this->Subject,'UTF-8',$this->CharSet);
                    if(!empty($this->AltBody)) $this->AltBody = $this->encodingHelper->change($this->AltBody,'UTF-8',$this->CharSet);
            }

            if($this->isElasticRest){
                $this->addCustomHeader('referral:cfb09bc8-558d-496b-83e6-b05e901a945c');
            }

            $this->Subject = str_replace(array('’','“','�','–'),array("'",'"','"','-'),$this->Subject);
            $this->Body = str_replace(chr(194),chr(32),$this->Body);
            ob_start();
            $result = parent::Send();


            $warnings = ob_get_clean();
            if(!empty($warnings) && strpos($warnings,'bloque')){
                    $result = false;
            }
            $receivers =  array();
            foreach($this->to as $oneReceiver){
                    $receivers[] = $oneReceiver[0];
            }
            if(!$result){

                $this->reportMessage = sprintf(__('Error Sending Message <b><i>%s</i></b> to <b><i>%s</i></b>',WYSIJA),$this->Subject,implode('", "',$receivers));
                    if(!empty($this->ErrorInfo)) {
                        //echo $this->ErrorInfo;

                        foreach($this->ErrorInfo as $error){
                            $this->reportMessage.=' | '.$error['error'];
                        }
                        $this->ErrorInfo=array();
                        //$this->error($this->ErrorInfo);
                        //$this->reportMessage();
                    }

                    if(!empty($warnings)) $this->reportMessage .= ' | '.$warnings;
                    $this->errorNumber = 1;
                    if($this->report){
                            $this->error($this->reportMessage);

                    }

            }else{
                    $this->reportMessage = sprintf(__('Successfully sent to <b><i>%s</i></b>',WYSIJA), implode('", "',$receivers));

                    if($this->report){
                        if(!empty($warnings)){
                            $this->reportMessage .= ' | '.$warnings;
                            $this->notice($this->reportMessage,false);
                        }

                    }
            }
            return $result;
	}
コード例 #2
0
 public function send()
 {
     if (empty($this->ReplyTo)) {
         $this->_addReplyTo($this->config->get('reply_email'), $this->config->get('reply_name'));
     }
     if ((bool) $this->config->get('embed_images', 0) && $this->Mailer != 'elasticemail') {
         $this->embedImages();
     }
     if (empty($this->Subject) or empty($this->Body)) {
         $this->reportMessage = JText::_('SEND_EMPTY');
         $this->errorNumber = 8;
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
         }
         return false;
     }
     if (!$this->alreadyCheckedAddresses) {
         $this->alreadyCheckedAddresses = true;
         $replyToTmp = '';
         if (!empty($this->ReplyTo)) {
             $replyToTmp = reset($this->ReplyTo);
         }
         if (empty($this->ReplyTo) || !$this->userHelper->validEmail($replyToTmp[0])) {
             $this->reportMessage = JText::_('VALID_EMAIL') . ' ( ' . JText::_('REPLYTO_ADDRESS') . ' : ' . (empty($this->ReplyTo) ? '' : $replyToTmp[0]) . ' ) ';
             $this->errorNumber = 9;
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             return false;
         }
         if (empty($this->From) || !$this->userHelper->validEmail($this->From)) {
             $this->reportMessage = JText::_('VALID_EMAIL') . ' ( ' . JText::_('FROM_ADDRESS') . ' : ' . $this->From . ' ) ';
             $this->errorNumber = 9;
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             return false;
         }
         if (!empty($this->Sender) && !$this->userHelper->validEmail($this->Sender)) {
             $this->reportMessage = JText::_('VALID_EMAIL') . ' ( ' . JText::_('BOUNCE_ADDRESS') . ' : ' . $this->Sender . ' ) ';
             $this->errorNumber = 9;
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             return false;
         }
     }
     if (function_exists('mb_convert_encoding') && !empty($this->sendHTML)) {
         $this->Body = mb_convert_encoding($this->Body, 'HTML-ENTITIES', 'UTF-8');
         $this->Body = str_replace(array('&amp;', '&sigmaf;'), array('&', 'ς'), $this->Body);
     }
     if ($this->CharSet != 'utf-8') {
         $this->Body = $this->encodingHelper->change($this->Body, 'UTF-8', $this->CharSet);
         $this->Subject = $this->encodingHelper->change($this->Subject, 'UTF-8', $this->CharSet);
         if (!empty($this->AltBody)) {
             $this->AltBody = $this->encodingHelper->change($this->AltBody, 'UTF-8', $this->CharSet);
         }
     }
     if (strpos($this->Host, 'elasticemail')) {
         $this->addCustomHeader('referral:2f0447bb-173a-459d-ab1a-ab8cbebb9aab');
     }
     $this->Subject = str_replace(array('’', '“', '”', '–'), array("'", '"', '"', '-'), $this->Subject);
     $this->Body = str_replace(" ", ' ', $this->Body);
     ob_start();
     $result = parent::Send();
     $warnings = ob_get_clean();
     if (!empty($warnings) && strpos($warnings, 'bloque')) {
         $result = false;
     }
     $receivers = array();
     foreach ($this->to as $oneReceiver) {
         $receivers[] = $oneReceiver[0];
     }
     if (!$result) {
         $this->reportMessage = JText::sprintf('SEND_ERROR', '<b><i>' . $this->Subject . '</i></b>', '<b><i>' . implode(' , ', $receivers) . '</i></b>');
         if (!empty($this->ErrorInfo)) {
             $this->reportMessage .= ' | ' . $this->ErrorInfo;
         }
         if (!empty($warnings)) {
             $this->reportMessage .= ' | ' . $warnings;
         }
         $this->errorNumber = 1;
         if ($this->report) {
             $this->reportMessage = str_replace('Could not instantiate mail function', '<a target="_blank" href="' . ACYMAILING_REDIRECT . 'could-not-instantiate-mail-function" title="' . JText::_('TELL_ME_MORE') . '">Could not instantiate mail function</a>', $this->reportMessage);
             $this->app->enqueueMessage(nl2br($this->reportMessage), 'error');
         }
     } else {
         $this->reportMessage = JText::sprintf('SEND_SUCCESS', '<b><i>' . $this->Subject . '</i></b>', '<b><i>' . implode(' , ', $receivers) . '</i></b>');
         if (!empty($warnings)) {
             $this->reportMessage .= ' | ' . $warnings;
         }
         if ($this->report) {
             $this->app->enqueueMessage(nl2br($this->reportMessage), 'message');
         }
     }
     return $result;
 }
コード例 #3
0
 function send()
 {
     if (empty($this->ReplyTo)) {
         $this->_addReplyTo($this->config->get('reply_email'), $this->config->get('reply_name'));
     }
     if ((bool) $this->config->get('embed_images', 0)) {
         $this->embedImages();
     }
     if (empty($this->Subject) or empty($this->Body)) {
         $this->reportMessage = JText::_('SEND_EMPTY');
         $this->errorNumber = 8;
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
         }
         return false;
     }
     if (!$this->alreadyCheckedAddresses) {
         $this->alreadyCheckedAddresses = true;
         if (empty($this->ReplyTo[0][0]) || !$this->userHelper->validEmail($this->ReplyTo[0][0])) {
             $this->reportMessage = JText::_('VALID_EMAIL') . ' ( ' . JText::_('REPLYTO_ADDRESS') . ' : ' . $this->ReplyTo[0][0] . ' ) ';
             $this->errorNumber = 9;
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             return false;
         }
         if (empty($this->From) || !$this->userHelper->validEmail($this->From)) {
             $this->reportMessage = JText::_('VALID_EMAIL') . ' ( ' . JText::_('FROM_ADDRESS') . ' : ' . $this->From . ' ) ';
             $this->errorNumber = 9;
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             return false;
         }
         if (!empty($this->Sender) && !$this->userHelper->validEmail($this->Sender)) {
             $this->reportMessage = JText::_('VALID_EMAIL') . ' ( ' . JText::_('BOUNCE_ADDRESS') . ' : ' . $this->Sender . ' ) ';
             $this->errorNumber = 9;
             if ($this->report) {
                 $this->app->enqueueMessage($this->reportMessage, 'error');
             }
             return false;
         }
     }
     if (function_exists('mb_convert_encoding') && !empty($this->sendHTML)) {
         $this->Body = mb_convert_encoding($this->Body, 'HTML-ENTITIES', 'UTF-8');
         $this->Body = str_replace(array('&amp;', '&sigmaf;'), array('&', 'ς'), $this->Body);
     }
     if ($this->CharSet != 'utf-8') {
         $this->Body = $this->encodingHelper->change($this->Body, 'UTF-8', $this->CharSet);
         $this->Subject = $this->encodingHelper->change($this->Subject, 'UTF-8', $this->CharSet);
         if (!empty($this->AltBody)) {
             $this->AltBody = $this->encodingHelper->change($this->AltBody, 'UTF-8', $this->CharSet);
         }
     }
     if (strpos($this->Host, 'elasticemail')) {
         $this->addCustomHeader('referral:2f0447bb-173a-459d-ab1a-ab8cbebb9aab');
     }
     $this->Subject = str_replace(array('’', '“', '”', '–'), array("'", '"', '"', '-'), $this->Subject);
     $this->Body = str_replace(" ", ' ', $this->Body);
     ob_start();
     $result = parent::Send();
     $warnings = ob_get_clean();
     if (!empty($warnings) && strpos($warnings, 'bloque')) {
         $result = false;
     }
     $receivers = array();
     foreach ($this->to as $oneReceiver) {
         $receivers[] = $oneReceiver[0];
     }
     if (!$result) {
         $this->reportMessage = JText::sprintf('SEND_ERROR', $this->Subject, implode('", "', $receivers));
         if (!empty($this->ErrorInfo)) {
             $this->reportMessage .= ' | ' . $this->ErrorInfo;
         }
         if (!empty($warnings)) {
             $this->reportMessage .= ' | ' . $warnings;
         }
         $this->errorNumber = 1;
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
         }
     } else {
         $this->reportMessage = JText::sprintf('SEND_SUCCESS', $this->Subject, implode(' , ', $receivers));
         if (!empty($warnings)) {
             $this->reportMessage .= ' | ' . $warnings;
         }
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'message');
         }
     }
     return $result;
 }
コード例 #4
0
ファイル: mailer.php プロジェクト: bizanto/Hooked
 function send()
 {
     if (empty($this->ReplyTo)) {
         $replyToName = $this->config->get('add_names', true) ? $this->config->get('reply_name') : '';
         $this->AddReplyTo($this->config->get('reply_email'), $replyToName);
     }
     if ((bool) $this->config->get('embed_images', 0)) {
         $this->embedImages();
     }
     if (empty($this->Subject) or empty($this->Body)) {
         $this->reportMessage = JText::_('SEND_EMPTY');
         $this->errorNumber = 8;
         return false;
     }
     if (function_exists('mb_convert_encoding') && !empty($this->sendHTML)) {
         $this->Body = mb_convert_encoding($this->Body, 'HTML-ENTITIES', 'UTF-8');
         $this->Body = str_replace('&amp;', '&', $this->Body);
     }
     if ($this->CharSet != 'utf-8') {
         $this->Body = $this->encodingHelper->change($this->Body, 'UTF-8', $this->CharSet);
         $this->Subject = $this->encodingHelper->change($this->Subject, 'UTF-8', $this->CharSet);
         if (!empty($this->AltBody)) {
             $this->AltBody = $this->encodingHelper->change($this->AltBody, 'UTF-8', $this->CharSet);
         }
     }
     $this->Subject = str_replace(array('’', '“', '”'), array("'", '"', '"'), $this->Subject);
     $this->Body = str_replace(" ", ' ', $this->Body);
     ob_start();
     $result = parent::Send();
     $warnings = ob_get_clean();
     if (!empty($warnings) && strpos($warnings, 'bloque')) {
         $result = false;
     }
     $receivers = array();
     foreach ($this->to as $oneReceiver) {
         $receivers[] = $oneReceiver[0];
     }
     if (!$result) {
         $this->reportMessage = JText::sprintf('SEND_ERROR', $this->Subject, implode('", "', $receivers));
         if (!empty($this->ErrorInfo)) {
             $this->reportMessage .= ' | ' . $this->ErrorInfo;
         }
         if (!empty($warnings)) {
             $this->reportMessage .= ' | ' . $warnings;
         }
         $this->errorNumber = 1;
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
         }
     } else {
         $this->reportMessage = JText::sprintf('SEND_SUCCESS', $this->Subject, implode('", "', $receivers));
         if (!empty($warnings)) {
             $this->reportMessage .= ' | ' . $warnings;
         }
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'message');
         }
     }
     return $result;
 }
コード例 #5
0
ファイル: mailer.php プロジェクト: rlee1962/diylegalcenter
 function send()
 {
     if (empty($this->ReplyTo)) {
         $replyToName = $this->config->get('add_names', true) ? $this->config->get('reply_name') : '';
         $this->AddReplyTo($this->config->get('reply_email'), $replyToName);
     }
     if ((bool) $this->config->get('embed_images', 0)) {
         $this->embedImages();
     }
     if (empty($this->Subject) or empty($this->Body)) {
         $this->reportMessage = JText::_('SEND_EMPTY');
         $this->errorNumber = 8;
         return false;
     }
     if (strtoupper($this->CharSet) != 'UTF-8') {
         $this->Body = $this->encodingHelper->change($this->Body, 'UTF-8', $this->CharSet);
         $this->Subject = $this->encodingHelper->change($this->Subject, 'UTF-8', $this->CharSet);
         if (!empty($this->AltBody)) {
             $this->AltBody = $this->encodingHelper->change($this->AltBody, 'UTF-8', $this->CharSet);
         }
     }
     $this->Body = str_replace(" ", ' ', $this->Body);
     ob_start();
     $result = parent::Send();
     $warnings = ob_get_clean();
     $receivers = array();
     foreach ($this->to as $oneReceiver) {
         $receivers[] = $oneReceiver[0];
     }
     if (!$result) {
         $this->reportMessage = JText::sprintf('SEND_ERROR', $this->Subject, implode('", "', $receivers));
         if (!empty($this->ErrorInfo)) {
             $this->reportMessage .= ' | ' . $this->ErrorInfo;
         }
         $this->errorNumber = 1;
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'error');
             if (!empty($warnings)) {
                 $this->app->enqueueMessage($warnings, 'notice');
             }
         }
     } else {
         $this->reportMessage = JText::sprintf('SEND_SUCCESS', $this->Subject, implode('", "', $receivers));
         if ($this->report) {
             $this->app->enqueueMessage($this->reportMessage, 'message');
         }
     }
     return $result;
 }
コード例 #6
0
ファイル: mailer.php プロジェクト: rotoballer/emily
 function send()
 {
     if (!empty($this->sendHTML)) {
         $this->AltBody = $this->textVersion($this->Body, true);
     } else {
         $this->Body = $this->textVersion($this->Body, false);
     }
     if (empty($this->ReplyTo)) {
         $replyToName = $this->config->getValue('reply_name');
         $this->AddReplyTo($this->config->getValue('reply_email'), $replyToName);
     }
     if (empty($this->Subject) or empty($this->Body)) {
         $this->reportMessage = __("There is no subject or body in this email", WYSIJA);
         $this->errorNumber = 8;
         return false;
     }
     if (function_exists('mb_convert_encoding') && !empty($this->sendHTML)) {
         $this->Body = mb_convert_encoding($this->Body, 'HTML-ENTITIES', 'UTF-8');
         $this->Body = str_replace('&amp;', '&', $this->Body);
     }
     if ($this->CharSet != 'utf-8') {
         $this->Body = $this->encodingHelper->change($this->Body, 'UTF-8', $this->CharSet);
         $this->Subject = $this->encodingHelper->change($this->Subject, 'UTF-8', $this->CharSet);
         if (!empty($this->AltBody)) {
             $this->AltBody = $this->encodingHelper->change($this->AltBody, 'UTF-8', $this->CharSet);
         }
     }
     $this->Subject = str_replace(array('’', '“', '”', '–'), array("'", '"', '"', '-'), $this->Subject);
     $this->Body = str_replace(chr(194), chr(32), $this->Body);
     ob_start();
     $result = parent::Send();
     $warnings = ob_get_clean();
     if (!empty($warnings) && strpos($warnings, 'bloque')) {
         $result = false;
     }
     $receivers = array();
     foreach ($this->to as $oneReceiver) {
         $receivers[] = $oneReceiver[0];
     }
     if (!$result) {
         $this->reportMessage = sprintf(__("Error Sending Message <b><i>%s</i></b> to <b><i>%s</i></b>", WYSIJA), $this->Subject, implode('", "', $receivers));
         if (!empty($this->ErrorInfo)) {
             foreach ($this->ErrorInfo as $error) {
                 $this->error($error['error']);
             }
         }
         if (!empty($warnings)) {
             $this->reportMessage .= ' | ' . $warnings;
         }
         $this->errorNumber = 1;
         if ($this->report) {
             $this->error($this->reportMessage);
         }
     } else {
         $this->reportMessage = sprintf(__("Message <b><i>%s</i></b> successfully sent to <b><i>%s</i></b>", WYSIJA), $this->Subject, implode('", "', $receivers));
         if ($this->report) {
             if (!empty($warnings)) {
                 $this->reportMessage .= ' | ' . $warnings;
                 $this->notice($this->reportMessage, false);
             }
         }
     }
     return $result;
 }