added patch from feature request to use getFrom function.
authorcentaurix <centaurix@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 11 May 2002 15:06:03 +0000 (15:06 +0000)
committercentaurix <centaurix@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 11 May 2002 15:06:03 +0000 (15:06 +0000)
now envelopes are set correctly to the from address (not just : username@domain)

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2817 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/smtp.php

index 24f92d03053a1496450e5bdf27474a508dc092cf..5e75527d6bfbf9584f022de6282066fb44887690 100644 (file)
@@ -263,16 +263,11 @@ function write822Header ($fp, $t, $c, $b, $subject, $more_headers, $session, $rn
         if (isset($identity) && $identity != 'default') {
             $reply_to = getPref($data_dir, $username, 'reply_to' . $identity);
             $from = getPref($data_dir, $username, 'full_name' . $identity);
-            $from_addr = getPref($data_dir, $username, 
-                                 'email_address' . $identity);
+            $from_addr = getFrom();
         } else {
             $reply_to = getPref($data_dir, $username, 'reply_to');
             $from = getPref($data_dir, $username, 'full_name');
-            $from_addr = getPref($data_dir, $username, 'email_address');
-        }
-        
-        if ($from_addr == '') {
-            $from_addr = $popuser.'@'.$domain;
+            $from_addr = getFrom();
         }
         
         $to_list = getLineOfAddrs($to);
@@ -438,7 +433,7 @@ function sendSendmail($t, $c, $b, $subject, $body, $more_headers, $session) {
      * spaces or other "weird" chars that would allow a user to
      * exploit the shell/pipe it is used in.
      */
-    $envelopefrom = "$popuser@$domain";
+    $envelopefrom = getFrom();
     $envelopefrom = ereg_replace("[[:blank:]]",'', $envelopefrom);
     $envelopefrom = ereg_replace("[[:space:]]",'', $envelopefrom);
     $envelopefrom = ereg_replace("[[:cntrl:]]",'', $envelopefrom);
@@ -458,7 +453,7 @@ function sendSendmail($t, $c, $b, $subject, $body, $more_headers, $session) {
     $bodylength = writeBody($fp, $body, $session, "\n");
     
     pclose($fp);
-    
+
     return ($headerlength + $bodylength);
 }
 
@@ -937,5 +932,24 @@ function createReceiptHeaders($receipt) {
     return $receipt_headers;
 }
 
+/* Figure out what the 'From:' address is
+ */
+
+function getFrom() {
+    global $username, $popuser, $domain, $data_dir, $identity;
+    if (isset($identity) && $identity != 'default') {
+        $from_addr = getPref($data_dir, $username, 
+                             'email_address' . $identity);
+    }
+    else {
+        $from_addr = getPref($data_dir, $username, 'email_address');
+    }
+    
+    if (!$from_addr) {
+        $from_addr = "$popuser@$domain";
+    }
+    return $from_addr;
+}
+
 
 ?>