Tidy up indenting, etc using perltidy
[squirrelmail.git] / functions / smtp.php
index 03ad8a581ea4c3936e2af8e8aac3338f283eb92d..13ffe93be25aa83fee221e8ee0070b046bb71011 100644 (file)
@@ -476,7 +476,9 @@ function sendSMTP($t, $c, $b, $subject, $body, $more_headers) {
         exit;
     }
     $tmp = fgets($smtpConnection, 1024);
-    if (errorCheck($tmp, $smtpConnection)!=5) return(0);
+    if (errorCheck($tmp, $smtpConnection)!=5) {
+        return(0);
+    }
     
     $to_list = getLineOfAddrs($to);
     $cc_list = getLineOfAddrs($cc);
@@ -555,11 +557,6 @@ function sendSMTP($t, $c, $b, $subject, $body, $more_headers) {
     $tmp = fgets($smtpConnection, 1024);
     $num = errorCheck($tmp, $smtpConnection, true);
     if ($num != 250) {
-        $tmp = nl2br(htmlspecialchars($tmp));
-        displayPageHeader($color, 'None');
-        include_once('../functions/display_messages.php');
-        $msg  = "Message not sent!<br>\nReason given: $tmp";
-        plain_error_message($msg, $color);
         return(0);
     }
     
@@ -572,7 +569,7 @@ function sendSMTP($t, $c, $b, $subject, $body, $more_headers) {
 
 
 function errorCheck($line, $smtpConnection, $verbose = false) {
-    global $color;
+    global $color, $compose_new_win;
     
     /* Read new lines on a multiline response */
     $lines = $line;
@@ -664,7 +661,12 @@ function errorCheck($line, $smtpConnection, $verbose = false) {
     
     if ($status == 0) {
         include_once('../functions/page_header.php');
-        displayPageHeader($color, 'None');
+        if ($compose_new_win == '1') {
+            compose_Header($color, 'None');
+        }
+               else {
+            displayPageHeader($color, 'None');
+        }
         include_once('../functions/display_messages.php');
         $lines = nl2br(htmlspecialchars($lines));
         $msg  = $message . "<br>\nServer replied: $lines";
@@ -777,33 +779,35 @@ function createPriorityHeaders($prio) {
 }
 
 function createReceiptHeaders($receipt) {
-  
-  $receipt_headers = Array();
-  $from_addr = getPref($data_dir, $username, 'email_address');
-  $from = getPref($data_dir, $username, 'full_name');
-
-  if ($from == '') {
-    $from = "<$from_addr>";
-  }
-  else {
-    $from = '"' . encodeHeader($from) . "\" <$from_addr>";
-  }
-  
-  /* On Delivery */
-  if ( $receipt == 1 
-       || $receipt == 3 ) {
-    $receipt_headers["Return-Receipt-To"] = $from;
-  }
-  /* On Read */
-  if ($receipt == 2 
-      || $receipt == 3 ) {
-    /* Pegasus Mail */
-    $receipt_headers["X-Confirm-Reading-To"] = $from;
-    /* RFC 2298 */
-    $receipt_headers["Disposition-Notification-To"] = $from;
-  }
-  return $receipt_headers;
-}   
+
+    GLOBAL $data_dir, $username;
+
+    $receipt_headers = Array();
+    $from_addr = getPref($data_dir, $username, 'email_address');
+    $from = getPref($data_dir, $username, 'full_name');
+
+    if ($from == '') {
+        $from = "<$from_addr>";
+    }
+    else {
+        $from = '"' . encodeHeader($from) . "\" <$from_addr>";
+    }
+
+    /* On Delivery */
+    if ( $receipt == 1
+        || $receipt == 3 ) {
+        $receipt_headers["Return-Receipt-To"] = $from;
+    }
+    /* On Read */
+    if ($receipt == 2
+        || $receipt == 3 ) {
+        /* Pegasus Mail */
+        $receipt_headers["X-Confirm-Reading-To"] = $from;
+        /* RFC 2298 */
+        $receipt_headers["Disposition-Notification-To"] = $from;
+    }
+    return $receipt_headers;
+}
 
 
 ?>