]> git.andy128k.dev Git - ipf-mail.git/commitdiff
exception classes
authorAndrey Kutejko <andy128k@gmail.com>
Mon, 29 Jul 2013 06:19:53 +0000 (09:19 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Mon, 29 Jul 2013 06:19:53 +0000 (09:19 +0300)
16 files changed:
ipf/exception.php
ipf/mail.php
ipf/mail/exception.php [new file with mode: 0644]
ipf/mail/message.php
ipf/mail/part.php
ipf/mail/protocol/abstract.php
ipf/mail/protocol/imap.php
ipf/mail/protocol/pop3.php
ipf/mail/protocol/smtp.php
ipf/mail/transport/abstract.php
ipf/mail/transport/sendmail.php
ipf/mail/transport/smtp.php
ipf/mime/decode.php
ipf/mime/exception.php [new file with mode: 0644]
ipf/mime/message.php
ipf/mime/part.php

index c418db8609a481e2b9dc8db87e628d408f0c4b1c..ef36fc77d7ef9489c8551b2ef4d9211b938594ba 100644 (file)
@@ -1,3 +1,6 @@
 <?php
 
-class IPF_Exception extends Exception{}
+class IPF_Exception extends Exception
+{
+}
+
index 98f6d2bbed6fc20c98154237803eda02569b9cbf..705044299b41158ea895945bb8ae1abbea6aecfa 100644 (file)
@@ -39,7 +39,7 @@ class IPF_Mail extends IPF_Mime_Message
             IPF_Mime::MULTIPART_RELATED,
         );
         if (!in_array($type, $allowed)) {
-            throw new IPF_Exception_Mail('Invalid content type "' . $type . '"');
+            throw new IPF_Mail_Exception('Invalid content type "' . $type . '"');
         }
 
         $this->_type = $type;
@@ -225,7 +225,7 @@ class IPF_Mail extends IPF_Mime_Message
             $this->_from = $email;
             $this->_storeHeader('From', $this->_encodeHeader('"'.$name.'"').' <'.$email.'>', true);
         } else {
-            throw new IPF_Exception_Mail('From Header set twice');
+            throw new IPF_Mail_Exception('From Header set twice');
         }
         return $this;
     }
@@ -242,7 +242,7 @@ class IPF_Mail extends IPF_Mime_Message
             $this->_returnPath = $email;
             $this->_storeHeader('Return-Path', $email, false);
         } else {
-            throw new IPF_Exception_Mail('Return-Path Header set twice');
+            throw new IPF_Mail_Exception('Return-Path Header set twice');
         }
         return $this;
     }
@@ -266,7 +266,7 @@ class IPF_Mail extends IPF_Mime_Message
                 $this->_subject = IPF_Mime::encodeQ($subject);
             $this->_storeHeader('Subject', $this->_subject);
         } else {
-            throw new IPF_Exception_Mail('Subject set twice');
+            throw new IPF_Mail_Exception('Subject set twice');
         }
         return $this;
     }
@@ -286,17 +286,17 @@ class IPF_Mail extends IPF_Mime_Message
             } else if (is_string($date)) {
                $date = strtotime($date);
                 if ($date === false || $date < 0) {
-                    throw new IPF_Exception_Mail('String representations of Date Header must be ' .
+                    throw new IPF_Mail_Exception('String representations of Date Header must be ' .
                                                   'strtotime()-compatible');
                 }
                 $date = date('r', $date);
             } else {
-                throw new IPF_Exception_Mail(__METHOD__ . ' only accepts UNIX timestamps and strtotime()-compatible strings');
+                throw new IPF_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps and strtotime()-compatible strings');
             }
             $this->_date = $date;
             $this->_storeHeader('Date', $date);
         } else {
-            throw new IPF_Exception_Mail('Date Header set twice');
+            throw new IPF_Mail_Exception('Date Header set twice');
         }
         return $this;
     }
@@ -309,7 +309,7 @@ class IPF_Mail extends IPF_Mime_Message
     public function addHeader($name, $value, $append = false)
     {
         if (in_array(strtolower($name), array('to', 'cc', 'bcc', 'from', 'subject', 'return-path', 'date'))) {
-            throw new IPF_Exception_Mail('Cannot set standard header from addHeader()');
+            throw new IPF_Mail_Exception('Cannot set standard header from addHeader()');
         }
 
         $value = strtr($value,"\r\n\t",'???');
diff --git a/ipf/mail/exception.php b/ipf/mail/exception.php
new file mode 100644 (file)
index 0000000..8ec3e7a
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+
+class IPF_Mail_Exception extends Exception
+{
+}
+
index 8260fdd236d6614e0145d6f10420170837d33b5a..5220def95b2b2efadbd4c4d4c0bb74aa3dd08061 100644 (file)
@@ -10,7 +10,7 @@ class IPF_Mail_Message extends IPF_Mail_Part
             if (!is_resource($params['file'])) {
                 $params['raw'] = @file_get_contents($params['file']);
                 if ($params['raw'] === false) {
-                    throw new IPF_Exception_Mail('could not open file');
+                    throw new IPF_Mail_Exception('could not open file');
                 }
             } else {
                 $params['raw'] = stream_get_contents($params['file']);
index d5d54c18468a5b4d40adc3d3efa6d7cfc93ffd16..f74df14466ea1be9f1ed8d394d50c604b4d8a44c 100644 (file)
@@ -15,10 +15,10 @@ class IPF_Mail_Part implements RecursiveIterator
     {
         if (isset($params['handler'])) {
             if (!$params['handler'] instanceof IPF_Mail_Storage_Abstract) {
-                throw new IPF_Exception_Mail('handler is not a valid mail handler');
+                throw new IPF_Mail_Exception('handler is not a valid mail handler');
             }
             if (!isset($params['id'])) {
-                throw new IPF_Exception_Mail('need a message id with a handler');
+                throw new IPF_Mail_Exception('need a message id with a handler');
             }
 
             $this->_mail       = $params['handler'];
@@ -47,7 +47,7 @@ class IPF_Mail_Part implements RecursiveIterator
     {
         try {
             return stripos($this->contentType, 'multipart/') === 0;
-        } catch(IPF_Exception_Mail $e) {
+        } catch(IPF_Mail_Exception $e) {
             return false;
         }
     }
@@ -62,7 +62,7 @@ class IPF_Mail_Part implements RecursiveIterator
         if ($this->_mail) {
             return $this->_mail->getRawContent($this->_messageNum);
         } else {
-            throw new IPF_Exception_Mail('no content');
+            throw new IPF_Mail_Exception('no content');
         }
     }
 
@@ -80,7 +80,7 @@ class IPF_Mail_Part implements RecursiveIterator
         // split content in parts
         $boundary = $this->getHeaderField('content-type', 'boundary');
         if (!$boundary) {
-            throw new IPF_Exception_Mail('no boundary found in content type to split message');
+            throw new IPF_Mail_Exception('no boundary found in content type to split message');
         }
         $parts = IPF_Mime_Decode::splitMessageStruct($this->_content, $boundary);
         $counter = 1;
@@ -96,7 +96,7 @@ class IPF_Mail_Part implements RecursiveIterator
         }
 
         if (!$this->_mail && $this->_content === null) {
-            throw new IPF_Exception_Mail('part not found');
+            throw new IPF_Mail_Exception('part not found');
         }
 
         if ($this->_mail && $this->_mail->hasFetchPart) {
@@ -107,7 +107,7 @@ class IPF_Mail_Part implements RecursiveIterator
         $this->_cacheContent();
 
         if (!isset($this->_parts[$num])) {
-            throw new IPF_Exception_Mail('part not found');
+            throw new IPF_Mail_Exception('part not found');
         }
 
         return $this->_parts[$num];
@@ -160,7 +160,7 @@ class IPF_Mail_Part implements RecursiveIterator
         if (!isset($this->_headers[$lowerName])) {
             $lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name));
             if (!isset($this->_headers[$lowerName])) {
-                throw new IPF_Exception_Mail("no Header with Name $name found");
+                throw new IPF_Mail_Exception("no Header with Name $name found");
             }
         }
         $name = $lowerName;
index 139884ca420ccbc2ec5aebfce24084bb855f5249..88eb17a40eee7be7f7a4c255e52ddb2a995b661c 100644 (file)
@@ -57,11 +57,11 @@ abstract class IPF_Mail_Protocol_Abstract
             if ($errorNum == 0) {
                 $errorStr = 'Could not open socket';
             }
-            throw new IPF_Exception_Mail($errorStr);
+            throw new IPF_Mail_Exception($errorStr);
         }
 
         if (($result = stream_set_timeout($this->_socket, self::TIMEOUT_CONNECTION)) === false) {
-            throw new IPF_Exception_Mail('Could not set stream timeout');
+            throw new IPF_Mail_Exception('Could not set stream timeout');
         }
 
         return $result;
@@ -77,7 +77,7 @@ abstract class IPF_Mail_Protocol_Abstract
     protected function _send($request)
     {
         if (!is_resource($this->_socket)) {
-            throw new IPF_Exception_Mail('No connection has been established to ' . $this->_host);
+            throw new IPF_Mail_Exception('No connection has been established to ' . $this->_host);
         }
 
         $this->_request = $request;
@@ -88,7 +88,7 @@ abstract class IPF_Mail_Protocol_Abstract
         $this->_log .= $request . self::EOL;
 
         if ($result === false) {
-            throw new IPF_Exception_Mail('Could not send request to ' . $this->_host);
+            throw new IPF_Mail_Exception('Could not send request to ' . $this->_host);
         }
 
         return $result;
@@ -97,7 +97,7 @@ abstract class IPF_Mail_Protocol_Abstract
     protected function _receive($timeout = null)
     {
         if (!is_resource($this->_socket)) {
-            throw new IPF_Exception_Mail('No connection has been established to ' . $this->_host);
+            throw new IPF_Mail_Exception('No connection has been established to ' . $this->_host);
         }
 
         // Adapters may wish to supply per-commend timeouts according to appropriate RFC
@@ -115,11 +115,11 @@ abstract class IPF_Mail_Protocol_Abstract
         $info = stream_get_meta_data($this->_socket);
 
         if (!empty($info['timed_out'])) {
-            throw new IPF_Exception_Mail($this->_host . ' has timed out');
+            throw new IPF_Mail_Exception($this->_host . ' has timed out');
         }
 
         if ($reponse === false) {
-            throw new IPF_Exception_Mail('Could not read from ' . $this->_host);
+            throw new IPF_Mail_Exception('Could not read from ' . $this->_host);
         }
 
         return $reponse;
@@ -138,7 +138,7 @@ abstract class IPF_Mail_Protocol_Abstract
             sscanf($result, $this->_template, $cmd, $msg);
 
             if ($cmd === null || !in_array($cmd, $code)) {
-                throw new IPF_Exception_Mail($result);
+                throw new IPF_Mail_Exception($result);
             }
 
         } while (strpos($msg, '-') === 0); // The '-' message prefix indicates an information string instead of a response string.
index 109e48828f5a7cc517fee113ede31350496d3a99..6ac14c23146c6291a19fbcedc4c1645ff5fbb58e 100644 (file)
@@ -29,18 +29,18 @@ class IPF_Mail_Protocol_Imap
 
         $this->_socket = @fsockopen($host, $port);
         if (!$this->_socket) {
-            throw new IPF_Exception_Mail('cannot connect to host');
+            throw new IPF_Mail_Exception('cannot connect to host');
         }
 
         if (!$this->_assumedNextLine('* OK')) {
-            throw new IPF_Exception_Mail('host doesn\'t allow connection');
+            throw new IPF_Mail_Exception('host doesn\'t allow connection');
         }
 
         if ($ssl === 'TLS') {
             $result = $this->requestAndResponse('STARTTLS');
             $result = $result && stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
             if (!$result) {
-                throw new IPF_Exception_Mail('cannot enable TLS');
+                throw new IPF_Mail_Exception('cannot enable TLS');
             }
         }
     }
@@ -49,7 +49,7 @@ class IPF_Mail_Protocol_Imap
     {
         $line = @fgets($this->_socket);
         if ($line === false) {
-            throw new IPF_Exception_Mail('cannot read - connection closed?');
+            throw new IPF_Mail_Exception('cannot read - connection closed?');
         }
 
         return $line;
@@ -204,10 +204,10 @@ class IPF_Mail_Protocol_Imap
         foreach ($tokens as $token) {
             if (is_array($token)) {
                 if (@fputs($this->_socket, $line . ' ' . $token[0] . "\r\n") === false) {
-                    throw new IPF_Exception_Mail('cannot write - connection closed?');
+                    throw new IPF_Mail_Exception('cannot write - connection closed?');
                 }
                 if (!$this->_assumedNextLine('+ ')) {
-                    throw new IPF_Exception_Mail('cannot send literal string');
+                    throw new IPF_Mail_Exception('cannot send literal string');
                 }
                 $line = $token[1];
             } else {
@@ -216,7 +216,7 @@ class IPF_Mail_Protocol_Imap
         }
 
         if (@fputs($this->_socket, $line . "\r\n") === false) {
-            throw new IPF_Exception_Mail('cannot write - connection closed?');
+            throw new IPF_Mail_Exception('cannot write - connection closed?');
         }
     }
 
@@ -269,7 +269,7 @@ class IPF_Mail_Protocol_Imap
         if ($this->_socket) {
             try {
                 $result = $this->requestAndResponse('LOGOUT', array(), true);
-            } catch (IPF_Exception_Mail $e) {
+            } catch (IPF_Mail_Exception $e) {
                 // ignoring exception
             }
             fclose($this->_socket);
@@ -393,7 +393,7 @@ class IPF_Mail_Protocol_Imap
         }
 
         if ($to === null && !is_array($from)) {
-            throw new IPF_Exception_Mail('the single id was not found in response');
+            throw new IPF_Mail_Exception('the single id was not found in response');
         }
 
         return $result;
index 4648b48209ddf69b3ae3956ad72cab2bdcc05de1..cd148c9a54a111fc6c35bb85bcbd337581d806bc 100644 (file)
@@ -30,7 +30,7 @@ class IPF_Mail_Protocol_Pop3
 
         $this->_socket = @fsockopen($host, $port);
         if (!$this->_socket) {
-            throw new IPF_Exception_Mail('cannot connect to host');
+            throw new IPF_Mail_Exception('cannot connect to host');
         }
 
         $welcome = $this->readResponse();
@@ -47,7 +47,7 @@ class IPF_Mail_Protocol_Pop3
             $this->request('STLS');
             $result = stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
             if (!$result) {
-                throw new IPF_Exception_Mail('cannot enable TLS');
+                throw new IPF_Mail_Exception('cannot enable TLS');
             }
         }
 
@@ -58,7 +58,7 @@ class IPF_Mail_Protocol_Pop3
     {
         $result = @fputs($this->_socket, $request . "\r\n");
         if (!$result) {
-            throw new IPF_Exception_Mail('send failed - connection closed?');
+            throw new IPF_Mail_Exception('send failed - connection closed?');
         }
     }
 
@@ -66,7 +66,7 @@ class IPF_Mail_Protocol_Pop3
     {
         $result = @fgets($this->_socket);
         if (!is_string($result)) {
-            throw new IPF_Exception_Mail('read failed - connection closed?');
+            throw new IPF_Mail_Exception('read failed - connection closed?');
         }
 
         $result = trim($result);
@@ -78,7 +78,7 @@ class IPF_Mail_Protocol_Pop3
         }
 
         if ($status != '+OK') {
-            throw new IPF_Exception_Mail('last request failed');
+            throw new IPF_Mail_Exception('last request failed');
         }
 
         if ($multiline) {
@@ -107,7 +107,7 @@ class IPF_Mail_Protocol_Pop3
 
         try {
             $this->request('QUIT');
-        } catch (IPF_Exception_Mail $e) {
+        } catch (IPF_Mail_Exception $e) {
             // ignore error - we're closing the socket anyway
         }
 
@@ -127,7 +127,7 @@ class IPF_Mail_Protocol_Pop3
             try {
                 $this->request("APOP $user " . md5($this->_timestamp . $password));
                 return;
-            } catch (IPF_Exception_Mail $e) {
+            } catch (IPF_Mail_Exception $e) {
                 // ignore
             }
         }
@@ -197,7 +197,7 @@ class IPF_Mail_Protocol_Pop3
             if ($fallback) {
                 return $this->retrieve($msgno);
             } else {
-                throw new IPF_Exception_Mail('top not supported and no fallback wanted');
+                throw new IPF_Mail_Exception('top not supported and no fallback wanted');
             }
         }
         $this->hasTop = true;
@@ -206,7 +206,7 @@ class IPF_Mail_Protocol_Pop3
 
         try {
             $result = $this->request("TOP $msgno $lines", true);
-        } catch (IPF_Exception_Mail $e) {
+        } catch (IPF_Mail_Exception $e) {
             $this->hasTop = false;
             if ($fallback) {
                 $result = $this->retrieve($msgno);
index c122bf75f1c365b10b1da3f6a8752b1f42df7d27..008f26fce7bea99b6112fd636738d7b561e32421 100644 (file)
@@ -28,7 +28,7 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
                     break;
 
                 default:
-                    throw new IPF_Exception_Mail($config['ssl'] . ' is unsupported SSL type');
+                    throw new IPF_Mail_Exception($config['ssl'] . ' is unsupported SSL type');
                     break;
             }
         }
@@ -53,12 +53,12 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
     {
         // Respect RFC 2821 and disallow HELO attempts if session is already initiated.
         if ($this->_sess === true) {
-            throw new IPF_Exception_Mail('Cannot issue HELO to existing session');
+            throw new IPF_Mail_Exception('Cannot issue HELO to existing session');
         }
 
         // Validate client hostname
         if (!$this->_validHost->isValid($host)) {
-            throw new IPF_Exception_Mail(join(', ', $this->_validHost->getMessage()));
+            throw new IPF_Mail_Exception(join(', ', $this->_validHost->getMessage()));
         }
 
         // Initiate helo sequence
@@ -70,7 +70,7 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
             $this->_send('STARTTLS');
             $this->_expect(220, 180);
             if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
-                throw new IPF_Exception_Mail('Unable to connect via TLS');
+                throw new IPF_Mail_Exception('Unable to connect via TLS');
             }
             $this->_ehlo($host);
         }
@@ -85,10 +85,10 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
         try {
             $this->_send('EHLO ' . $host);
             $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
-        } catch (IPF_Exception_Mail $e) {
+        } catch (IPF_Mail_Exception $e) {
             $this->_send('HELO ' . $host);
             $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
-        } catch (IPF_Exception_Mail $e) {
+        } catch (IPF_Mail_Exception $e) {
             throw $e;
         }
     }
@@ -96,7 +96,7 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
     public function mail($from)
     {
         if ($this->_sess !== true) {
-            throw new IPF_Exception_Mail('A valid session has not been started');
+            throw new IPF_Mail_Exception('A valid session has not been started');
         }
 
         $this->_send('MAIL FROM:<' . $from . '>');
@@ -111,7 +111,7 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
     public function rcpt($to)
     {
         if ($this->_mail !== true) {
-            throw new IPF_Exception_Mail('No sender reverse path has been supplied');
+            throw new IPF_Mail_Exception('No sender reverse path has been supplied');
         }
 
         // Set rcpt to true, as per 4.1.1.3 of RFC 2821
@@ -124,7 +124,7 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
     {
         // Ensure recipients have been set
         if ($this->_rcpt !== true) {
-            throw new IPF_Exception_Mail('No recipient forward path has been supplied');
+            throw new IPF_Mail_Exception('No recipient forward path has been supplied');
         }
 
         $this->_send('DATA');
@@ -178,7 +178,7 @@ class IPF_Mail_Protocol_Smtp extends IPF_Mail_Protocol_Abstract
     public function auth()
     {
         if ($this->_auth === true) {
-            throw new IPF_Exception_Mail('Already authenticated for this session');
+            throw new IPF_Mail_Exception('Already authenticated for this session');
         }
     }
 
index 68e504494a51f74cd0f311a24034b897689e8c86..91dcfcb7945d9e58ca0159f265cbdefaf6442b36 100644 (file)
@@ -50,7 +50,7 @@ abstract class IPF_Mail_Transport_Abstract
     protected function _prepareHeaders($headers)
     {
         if (!$this->_mail) {
-            throw new IPF_Exception_Mail('Missing IPF_Mail object in _mail property');
+            throw new IPF_Mail_Exception('Missing IPF_Mail object in _mail property');
         }
 
         $this->header = '';
@@ -75,7 +75,7 @@ abstract class IPF_Mail_Transport_Abstract
             }
         }
         if (!$sane) {
-            throw new IPF_Exception_Mail('At least one mail header line is too long');
+            throw new IPF_Mail_Exception('At least one mail header line is too long');
         }
     }
 
@@ -126,7 +126,7 @@ abstract class IPF_Mail_Transport_Abstract
         }
 
         if (!$body) {
-            throw new IPF_Exception_Mail('No body specified');
+            throw new IPF_Mail_Exception('No body specified');
         }
 
         // Get headers
@@ -153,7 +153,7 @@ abstract class IPF_Mail_Transport_Abstract
         $count    = count($this->_parts);
         $boundary = null;
         if ($count < 1) {
-            throw new IPF_Exception_Mail('Empty mail cannot be sent');
+            throw new IPF_Mail_Exception('Empty mail cannot be sent');
         }
 
         if ($count > 1) {
index 487b6546bb2798d9c35705dbeff5db9056546def..6a16fc1f94c083886b324a5bc854bc9d510a86e0 100644 (file)
@@ -28,14 +28,14 @@ class IPF_Mail_Transport_Sendmail extends IPF_Mail_Transport_Abstract
                 $this->parameters);
         }
         if (!$result) {
-            throw new IPF_Exception_Mail('Unable to send mail');
+            throw new IPF_Mail_Exception('Unable to send mail');
         }
     }
 
     protected function _prepareHeaders($headers)
     {
         if (!$this->_mail) {
-            throw new IPF_Exception_Mail('_prepareHeaders requires a registered IPF_Mail object');
+            throw new IPF_Mail_Exception('_prepareHeaders requires a registered IPF_Mail object');
         }
 
         // mail() uses its $to parameter to set the To: header, and the $subject
@@ -43,12 +43,12 @@ class IPF_Mail_Transport_Sendmail extends IPF_Mail_Transport_Abstract
         if (0 === strpos(PHP_OS, 'WIN')) {
             // If the current recipients list is empty, throw an error
             if (empty($this->recipients)) {
-                throw new IPF_Exception_Mail('Missing To addresses');
+                throw new IPF_Mail_Exception('Missing To addresses');
             }
         } else {
             // All others, simply grab the recipients and unset the To: header
             if (!isset($headers['To'])) {
-                throw new IPF_Exception_Mail('Missing To header');
+                throw new IPF_Mail_Exception('Missing To header');
             }
 
             unset($headers['To']['append']);
index d37ded4c123056ad84006ef835344879b8db2c18..e099a4d1bff7ee98755de728d1b082be265ed55a 100644 (file)
@@ -31,7 +31,7 @@ class IPF_Mail_Transport_Smtp extends IPF_Mail_Transport_Abstract
         if ($this->_connection instanceof IPF_Mail_Protocol_Smtp) {
             try {
                 $this->_connection->quit();
-            } catch (IPF_Exception_Mail $e) {
+            } catch (IPF_Mail_Exception $e) {
                // ignore
             }
             $this->_connection->disconnect();
@@ -80,7 +80,7 @@ class IPF_Mail_Transport_Smtp extends IPF_Mail_Transport_Abstract
     protected function _prepareHeaders($headers)
     {
         if (!$this->_mail) {
-            throw new IPF_Exception_Mail('_prepareHeaders requires a registered IPF_Mail object');
+            throw new IPF_Mail_Exception('_prepareHeaders requires a registered IPF_Mail object');
         }
 
         unset($headers['Bcc']);
index a1e92dee494e98ccc3838f6f9f46fdd3326efeea..e4a5d4225609c9b7ee670fd5923af5dd2f9b717b 100644 (file)
@@ -29,7 +29,7 @@ class IPF_Mime_Decode
         // no more parts, find end boundary
         $p = strpos($body, '--' . $boundary . '--', $start);
         if ($p===false) {
-            throw new IPF_Exception('Not a valid Mime Message: End Missing');
+            throw new IPF_Mime_Exception('Not a valid Mime Message: End Missing');
         }
 
         // the remaining part also needs to be parsed:
@@ -117,7 +117,7 @@ class IPF_Mime_Decode
         
         $field = $firstName . '=' . $field;
         if (!preg_match_all('%([^=\s]+)\s*=("[^"]+"|[^;]+)(;\s*|$)%', $field, $matches)) {
-            throw new IPF_Exception('not a valid header field');
+            throw new IPF_Mime_Exception('not a valid header field');
         }
 
         if ($wantedPart) {
diff --git a/ipf/mime/exception.php b/ipf/mime/exception.php
new file mode 100644 (file)
index 0000000..54d46df
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+
+class IPF_Mime_Exception extends Exception
+{
+}
+
index e351e08bb2ecbac0386c1fd90972f00496ecd998..b06848f211f0a0a1ad2a02db7c87e90d186cfdcc 100644 (file)
@@ -107,7 +107,7 @@ class IPF_Mime_Message
         // no more parts, find end boundary
         $p = strpos($body, '--' . $boundary . '--', $start);
         if ($p===false) {
-            throw new IPF_Exception('Not a valid Mime Message: End Missing');
+            throw new IPF_Mime_Exception('Not a valid Mime Message: End Missing');
         }
 
         // the remaining part also needs to be parsed:
@@ -145,7 +145,7 @@ class IPF_Mime_Message
                         $newPart->description = $value;
                         break;
                     default:
-                        throw new IPF_Exception('Unknown header ignored for MimePart:' . $key);
+                        throw new IPF_Mime_Exception('Unknown header ignored for MimePart:' . $key);
                 }
             }
             $res->addPart($newPart);
index 68e9b23484972a804e1701ead9debe53e634a844..1fbc5833a0a9728c4ddab49c7fa9b5bb1d5b205c 100644 (file)
@@ -30,7 +30,7 @@ class IPF_Mime_Part {
     public function getEncodedStream()
     {
         if (!$this->_isStream) {
-            throw new IPF_Exception('Attempt to get a stream from a string part');
+            throw new IPF_Mime_Exception('Attempt to get a stream from a string part');
         }
 
         //stream_filter_remove(); // ??? is that right?
@@ -46,7 +46,7 @@ class IPF_Mime_Part {
                     )
                 );
                 if (!is_resource($filter)) {
-                    throw new IPF_Exception('Failed to append quoted-printable filter');
+                    throw new IPF_Mime_Exception('Failed to append quoted-printable filter');
                 }
                 break;
             case IPF_Mime::ENCODING_BASE64:
@@ -60,7 +60,7 @@ class IPF_Mime_Part {
                     )
                 );
                 if (!is_resource($filter)) {
-                    throw new IPF_Exception('Failed to append base64 filter');
+                    throw new IPF_Mime_Exception('Failed to append base64 filter');
                 }
                 break;
             default: