added auto-lookup functionality -- aliases can now be typed in address bars
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 24 Feb 2001 16:06:18 +0000 (16:06 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 24 Feb 2001 16:06:18 +0000 (16:06 +0000)
in the compose form.

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

ChangeLog
functions/smtp.php

index 765b20c83b8d99f081d34dc76eed5329831a0c23..cf5dc575a0fea7258f2c1d9cd3d03f3d4779cda6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 Version 1.1.0 -- DEVELOPMENT
 ----------------------------
+- If aliases are typed in To, Cc, or Bcc, they are automatically lookedup in
+  in the addressbook and converted to the associated addresses.
 - Added collapseable folder listing (an option that can be turned on)
 - Added alternating row colors to improve interface
 - Added Croatian translation by Albert Novak <anovak@pu.carnet.hr>
index c4f4dac5d136fa33eb57db6b824c3a45cb7aae4a..306e0b4d664b598813580064f64b76b642925962 100644 (file)
@@ -8,6 +8,8 @@
     **/
 
    $smtp_php = true;
+   if (!isset($addressbook_php))
+      include('../functions/addressbook.php');
 
    // This should most probably go to some initialization...
    if (ereg("^([^@%/]+)[@%/](.+)$", $username, $usernamedata)) {
          return false;
    }
 
+   // looks up aliases in the addressbook and expands them to
+   // the full address.
+   function expandAddrs ($array) {
+      $abook = addressbook_init();
+      for ($i=0; $i < count($array); $i++) {
+         $result = $abook->lookup($array[$i]);
+         $ret = "";
+         if (isset($result['email'])) {
+            if (isset($result['name'])) {
+               $ret = '"'.$result['name'].'" ';
+            }
+            $ret .= '<'.$result['email'].'>';
+            $array[$i] = $ret;
+         }
+      }
+      return $array;
+   }
+
    // Attach the files that are due to be attached
    function attachFiles ($fp) {
       global $attachments, $attachment_dir;
       static $header, $headerlength;
 
       if ($header == '') {
-         $to = parseAddrs($t);
-         $cc = parseAddrs($c);
-         $bcc = parseAddrs($b);
+         $to = expandAddrs(parseAddrs($t));
+         $cc = expandAddrs(parseAddrs($c));
+         $bcc = expandAddrs(parseAddrs($b));
          $reply_to = getPref($data_dir, $username, 'reply_to');
          $from = getPref($data_dir, $username, 'full_name');
          $from_addr = getPref($data_dir, $username, 'email_address');
       global $username, $popuser, $domain, $version, $smtpServerAddress, $smtpPort,
          $data_dir, $color;
 
-      $to = parseAddrs($t);
-      $cc = parseAddrs($c);
-      $bcc = parseAddrs($b);
+      $to = expandAddrs(parseAddrs($t));
+      $cc = expandAddrs(parseAddrs($c));
+      $bcc = expandAddrs(parseAddrs($b));
       $from_addr = getPref($data_dir, $username, 'email_address');
 
       if (!$from_addr)