Fixed require_once paths in class/deliver/deliver_FOO.class.php
[squirrelmail.git] / class / deliver / Deliver_SMTP.class.php
index 8fdbf56f717f6ee3217604796859363266ec3c41..2c4ca6388c3a9fc0ce2983c76748065f241f3b5e 100644 (file)
@@ -1,6 +1,16 @@
 <?php
+/**
+ * Deliver_SMTP.class.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * Delivery backend for the Deliver class.
+ *
+ * $Id$
+ */
 
-require_once('Deliver.class.php');
+require_once('../class/deliver/Deliver.class.php');
 
 class Deliver_SMTP extends Deliver {
 
@@ -77,26 +87,33 @@ class Deliver_SMTP extends Deliver {
        /* send who the recipients are */
        for ($i = 0, $cnt = count($to); $i < $cnt; $i++) {
            if (!$to[$i]->host) $to[$i]->host = $domain;
-           fputs($stream, 'RCPT TO: <'.$to[$i]->mailbox.'@'.$to[$i]->host.">\r\n");
-           $tmp = fgets($stream, 1024);
-           if ($this->errorCheck($tmp, $stream)) {
-               return(0);
+           if ($to[$i]->mailbox) {
+               fputs($stream, 'RCPT TO: <'.$to[$i]->mailbox.'@'.$to[$i]->host.">\r\n");
+               $tmp = fgets($stream, 1024);
+               if ($this->errorCheck($tmp, $stream)) {
+                   return(0);
+               }
            }
        }
+       
        for ($i = 0, $cnt = count($cc); $i < $cnt; $i++) {      
-           if (!$cc[$i]->host) $cc[$i]->host = $domain;        
-           fputs($stream, 'RCPT TO: <'.$cc[$i]->mailbox.'@'.$cc[$i]->host.">\r\n");
-           $tmp = fgets($stream, 1024);
-           if ($this->errorCheck($tmp, $stream)) {
-               return(0);
+           if (!$cc[$i]->host) $cc[$i]->host = $domain;
+           if ($cc[$i]->mailbox) {
+               fputs($stream, 'RCPT TO: <'.$cc[$i]->mailbox.'@'.$cc[$i]->host.">\r\n");
+               $tmp = fgets($stream, 1024);
+               if ($this->errorCheck($tmp, $stream)) {
+                   return(0);
+               }
            }
        }
        for ($i = 0, $cnt = count($bcc); $i < $cnt; $i++) {
-           if (!$bcc[$i]->host) $bcc[$i]->host = $domain;      
-           fputs($stream, 'RCPT TO: <'.$bcc[$i]->mailbox.'@'.$bcc[$i]->host.">\r\n");
-           $tmp = fgets($stream, 1024);
-           if ($this->errorCheck($tmp, $stream)) {
-               return(0);
+           if (!$bcc[$i]->host) $bcc[$i]->host = $domain;
+           if ($bcc[$i]->mailbox) {
+               fputs($stream, 'RCPT TO: <'.$bcc[$i]->mailbox.'@'.$bcc[$i]->host.">\r\n");
+               $tmp = fgets($stream, 1024);
+               if ($this->errorCheck($tmp, $stream)) {
+                   return(0);
+               }
            }
         }
        /* Lets start sending the actual message */