Index: settings/site.ini
===================================================================
--- settings/site.ini	(revision 16142)
+++ settings/site.ini	(working copy)
@@ -790,6 +790,9 @@
 TransportPort=25
 TransportUser=
 TransportPassword=
+# Limit the No Recipients per Chunk of a mail
+# Implementation regarding http://www.ietf.org/rfc/rfc2821.txt
+RecipientsLimit=100
 AdminEmail=nospam@ez.no
 # The address which will be set at the sender of the e-mail as default
 EmailSender=
@@ -819,6 +822,7 @@
 # SendmailOptions[]=muchspam@ez.no
 SendmailOptions[]
 
+
 [ShopSettings]
 # This settings controls when the basket is cleared.
 # It can contain the following values:
Index: lib/ezutils/classes/ezsmtp.php
===================================================================
--- lib/ezutils/classes/ezsmtp.php	(revision 16142)
+++ lib/ezutils/classes/ezsmtp.php	(working copy)
@@ -28,6 +28,7 @@
         var $auth;
         var $user;
         var $pass;
+        var $recipientsLimit;
 
         /***************************************
         ** Constructor function. Arguments:
@@ -60,6 +61,7 @@
             $this->user                = '';
             $this->pass                = '';
             $this->errors           = array();
+            $this->recipientsLimit = 10;
 
             foreach($params as $key => $value){
                 $this->$key = $value;
@@ -120,49 +122,82 @@
             foreach($params as $key => $value){
                 $this->set($key, $value);
             }
-
+            $result = true;
+            $returnResult = true;
             if($this->is_connected()){
-
                 // Do we auth or not? Note the distinction between the auth variable and auth() function
                 if($this->auth AND !$this->authenticated){
                     if(!$this->auth())
                         return FALSE;
                 }
-                $this->mail($this->from);
+
+                // Build recpients list to split them into 100 blocks
+                $recipients = array();
+
                 if(is_array($this->recipients))
-                    foreach($this->recipients as $value)
-                        $this->rcpt($value);
+                {
+                    $recipients = array_merge($recipients,$this->recipients);
+                }
                 else
-                    $this->rcpt($this->recipients);
-
+                {
+                    $recipients[] = $this->recipients;
+                }
                 if(is_array($this->CcRecipients))
-                    foreach($this->CcRecipients as $value)
-                        $this->rcpt($value);
+                {
+                    $recipients = array_merge($recipients,$this->CcRecipients);
+                }
                 else
-                    $this->rcpt($this->CcRecipients);
-
+                {
+                    $recipients[] = $this->CcRecipients;
+                }
                 if(is_array($this->BccRecipients))
-                    foreach($this->BccRecipients as $value)
-                        $this->rcpt($value);
+                {
+                    $recipients = array_merge($recipients,$this->BccRecipients);
+                }
                 else
-                    $this->rcpt($this->BccRecipients);
+                {
+                    $recipients[] = $this->BccRecipients;
+                }
 
-                if(!$this->data())
-                    return FALSE;
+                if( !$this->recipientsLimit)
+                {
+                    $this->recipientsLimit = 100;
+                }
+                // Split recipients list into chunks
+                $recipients = array_chunk($recipients,$this->recipientsLimit );
+                $noChunk = 0;
+                foreach( $recipients as $chunk )
+                {
+                    $this->mail($this->from);
+                    $noChunk = $noChunk+1;
+                    foreach( $chunk as $value )
+                    {
+                        if($value)
+                            $this->rcpt($value);
+                    }
 
-                // Transparency
-                $headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF, $this->headers)));
-                $body    = str_replace(CRLF.'.', CRLF.'..', $this->body);
-                $body    = $body[0] == '.' ? '.'.$body : $body;
+                    if(!$this->data())
+                    {
+                        return FALSE;
+                    }
 
-                $this->send_data($headers);
-                $this->send_data('');
-                $this->send_data($body);
-                $this->send_data('.');
+                    // Transparency
+                    $headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF, $this->headers)));
+                    $body    = str_replace(CRLF.'.', CRLF.'..', $this->body);
+                    $body    = $body[0] == '.' ? '.'.$body : $body;
 
-                $result = (substr(trim($this->get_data()), 0, 3) === '250');
-                //$this->rset();
-                return $result;
+                    $this->send_data($headers);
+                    $this->send_data('');
+                    $this->send_data($body);
+                    $this->send_data('.');
+                    $result = (substr(trim($this->get_data()), 0, 3) === '250');
+                    $returnResult &= $result;
+                    if( $result == false)
+                    {
+                        $this->errors[] = 'Failed sending mail to: '.trim(implode(', ', $chunk));
+                    }
+                }
+                return $returnResult;
             }else{
                 $this->errors[] = 'Not connected!';
                 return FALSE;
@@ -225,6 +260,7 @@
         ***************************************/
 
         function quit(){
+            $error = '';
             if(is_resource($this->connection)
                     AND $this->send_data('QUIT')
                     AND substr(trim($error = $this->get_data()), 0, 3) === '221' ){
@@ -267,8 +303,10 @@
 
         function mail($from)
         {
-            if ( !preg_match( "/<.+>/", $from ) )
+            if ( !preg_match( "/.*(<.+>)/", $from, $matches ) )
                 $from = '<' . $from .'>';
+            else
+                $from = $matches[1];
             if($this->is_connected()
                 AND $this->send_data('MAIL FROM:'.$from.'')
                 AND substr(trim($this->get_data()), 0, 3) === '250' )
@@ -287,8 +325,11 @@
 
         function rcpt($to)
         {
-            if ( !preg_match( "/<.+>/", $to ) )
+            $error = '';
+            if ( !preg_match( "/.*(<.+>)/", $to, $matches ) )
                 $to = '<' . $to .'>';
+            else
+                $to = $matches[1];
             if($this->is_connected()
                 AND $this->send_data('RCPT TO:'.$to.'' )
                 AND substr(trim($error = $this->get_data()), 0, 3) === '250' )
@@ -307,10 +348,10 @@
         ***************************************/
 
         function data(){
-
-            if($this->is_connected()
-                AND $this->send_data('DATA')
-                AND substr(trim($error = $this->get_data()), 0, 3) === '354' ){
+            $error = '';
+            if($this->is_connected() )
+                if( $this->send_data('DATA') )
+                if( ( substr(trim($error = $this->get_data()), 0, 3) === '354' ) ) {
                 return TRUE;
 
             }else{
@@ -335,8 +376,7 @@
 
         function send_data($data){
             if(is_resource($this->connection)){
-                return fwrite($this->connection, $data.CRLF, strlen($data)+2);
-
+                return @fwrite($this->connection, $data.CRLF, strlen($data)+2);
             }else
                 return FALSE;
         }
Index: lib/ezutils/classes/ezsmtptransport.php
===================================================================
--- lib/ezutils/classes/ezsmtptransport.php	(revision 16142)
+++ lib/ezutils/classes/ezsmtptransport.php	(working copy)
@@ -58,6 +58,7 @@
         $parameters['host'] = $ini->variable( 'MailSettings', 'TransportServer' );
         $parameters['helo'] = $ini->variable( 'MailSettings', 'TransportServer' );
         $parameters['port'] = $ini->variable( 'MailSettings', 'TransportPort' );
+        $parameters['recipientsLimit'] = $ini->variable( 'MailSettings', 'RecipientsLimit' );
         $user = $ini->variable( 'MailSettings', 'TransportUser' );
         $password = $ini->variable( 'MailSettings', 'TransportPassword' );
         if ( $user and
@@ -103,10 +104,16 @@
         {
             $result = $smtp->send( $sendData );
             $mailSent = true;
-            if ( isset( $smtp->errors[0] ) )
+            if ( count( $smtp->errors ) > 0 )
             {
-                eZDebug::writeError( "Error sending SMTP mail: " . $smtp->errors[0], "eZSMTPTransport::sendMail()" );
-                $mailSent = false;
+                foreach( $smtp->errors as $error )
+                {
+                    if( $error != '' )
+                    {
+                        eZDebug::writeError( "Error sending SMTP mail: " . $error, "eZSMTPTransport::sendMail()" );
+                        $mailSent = false;
+                    }
+                }
             }
             $smtp->quit();
         }
