Browse Source

Added ability to configure Google Mail (Gmail) as the mail server behind SquirrelMail

pdontthink 15 years ago
parent
commit
ff7e42bca1
4 changed files with 117 additions and 2 deletions
  1. 46 1
      config/conf.pl
  2. 3 1
      doc/ChangeLog
  3. 60 0
      doc/presets.txt
  4. 8 0
      src/read_body.php

+ 46 - 1
config/conf.pl

@@ -545,7 +545,8 @@ $list_supported_imap_servers =
     "    hmailserver = hMailServer\n" .
     "    hmailserver = hMailServer\n" .
     "    macosx      = Mac OS X Mailserver\n" .
     "    macosx      = Mac OS X Mailserver\n" .
     "    mercury32   = Mercury/32\n" .
     "    mercury32   = Mercury/32\n" .
-    "    uw          = University of Washington's IMAP server\n";
+    "    uw          = University of Washington's IMAP server\n" .
+    "    gmail       = IMAP access to Google mail (Gmail) accounts\n";
 
 
 #####################################################################################
 #####################################################################################
 if ( $config_use_color == 1 ) {
 if ( $config_use_color == 1 ) {
@@ -5371,6 +5372,50 @@ sub set_defaults {
             $message = "\nIf you use IMAPdir depot, you must set default folder prefix to empty string.\n";
             $message = "\nIf you use IMAPdir depot, you must set default folder prefix to empty string.\n";
 
 
             $continue = 1;
             $continue = 1;
+        } elsif ( $server eq "gmail" ) {
+            $imap_server_type               = "gmail";
+            $default_folder_prefix          = "";
+            $trash_folder                   = "[Gmail]/Trash";
+            $default_move_to_trash          = true;
+            $sent_folder                    = "[Gmail]/Sent Mail";
+            $draft_folder                   = "[Gmail]/Drafts";
+            $auto_create_special            = false;
+            $show_prefix_option             = false;
+            $default_sub_of_inbox           = false;
+            $show_contain_subfolders_option = false;
+            $delete_folder                  = true;
+            $force_username_lowercase       = false;
+            $optional_delimiter             = "/";
+            $disp_default_folder_prefix     = "<none>";
+            $domain                         = "gmail.com";
+            $imapServerAddress              = "imap.gmail.com";
+            $imapPort                       = 993;
+            $use_imap_tls                   = true;
+            $imap_auth_mech                 = "login";
+            $smtpServerAddress              = "smtp.gmail.com";
+            $smtpPort                       = 465;
+            $pop_before_smtp                = false;
+            $useSendmail                    = false;
+            $use_smtp_tls                   = true;
+            $smtp_auth_mech                 = "login";
+            $continue = 1;
+
+            # Gmail changes system folder names (Drafts, Sent, Trash) out
+            # from under you when the user changes language settings
+            $message = "\nNOTE!  When a user changes languages in Gmail's interface, the\n" 
+                     . "Drafts, Sent and Trash folder names are changed to localized\n"
+                     . "versions thereof.  To see those folders correctly in SquirrelMail,\n"
+                     . "the user should change the SquirrelMail language to match.\n"
+                     . "Moreover, SquirrelMail then needs to be told what folders to use\n"
+                     . "for Drafts, Sent and Trash in Options --> Folder Preferences.\n"
+                     . "These default settings will only correctly find the Sent, Trash\n"
+                     . "and Drafts folders if both Gmail and SquirrelMail languages are\n"
+                     . "set to English.\n\n"
+                     . "Also note that in some regions (Europe?), the default folder\n"
+                     . "names (see main menu selection 3. Folder Defaults) are different\n"
+                     . "(they may need to have the prefix \"[Google Mail]\" instead of\n"
+                     . "\"[Gmail]\") and \"Trash\" may be called \"Bin\" instead.\n";
+
         } elsif ( $server eq "quit" ) {
         } elsif ( $server eq "quit" ) {
             $continue = 1;
             $continue = 1;
         } else {
         } else {

+ 3 - 1
doc/ChangeLog

@@ -333,8 +333,10 @@ Version 1.5.2 - SVN
   - Encoded From headers now properly quoted (#2830141).
   - Encoded From headers now properly quoted (#2830141).
   - Multibyte strings (notably subjects) are now handled correctly (#2824813,
   - Multibyte strings (notably subjects) are now handled correctly (#2824813,
     #2925731).
     #2925731).
-  - Send X-DNS-Prefetch-Control: off header to browsers to prevent information
+  - X-DNS-Prefetch-Control: off header is now sent to browsers to prevent information
     leakage when Firefox does DNS prefetching for URL's contained in emails.
     leakage when Firefox does DNS prefetching for URL's contained in emails.
+  - Added the ability to configure Google Mail (Gmail) as the mail server
+    behind SquirrelMail.
 
 
 Version 1.5.1 (branched on 2006-02-12)
 Version 1.5.1 (branched on 2006-02-12)
 --------------------------------------
 --------------------------------------

+ 60 - 0
doc/presets.txt

@@ -230,3 +230,63 @@ show_contain_subfolders_option = false
 
 
 
 
 * Configuration with Maildir++ depot and . delimiter - use courier preset.
 * Configuration with Maildir++ depot and . delimiter - use courier preset.
+
+
+---------------------
+'gmail' settings:
+---------------------
+Support for using SquirrelMail as a front end for Google Mail (Gmail)
+accounts was added in SquirrelMail versions 1.4.20 and 1.5.2 and is
+currently experimental.
+
+CAPABILITY IMAP4rev1 UNSELECT LITERAL+ IDLE NAMESPACE QUOTA ID XLIST CHILDREN
+X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE
+
+Notes:
+* Might want to remove "All Mail" from folder drop-down lists (such as the
+  ones for moving mail to folders... "All Mail" is not a folder in Gmail
+  (it is a super-folder that shows mail from all folders)
+* Might want to remove the whole folder list drop-down from Create Folder
+  section, since labels/folders are usually just created as children of <none>
+* Might want to remove any folders prefixed with [Gmail]/ from the rename
+  and delete folders drop down selectors, since those are Gmail system folders
+* Might want to tweak what's included in the (un)subscribe menus too(?)
+* The folder list order is slightly strange, with the Gmail system folders
+  listed below the user labels/folders
+* When a user changes languages in Gmail's interface, the Drafts, Sent and
+  Trash folder names are changed to localized versions thereof.  To see those
+  folders correctly in SquirrelMail, the user should change the SquirrelMail
+  language to match.  Moreover, SquirrelMail then needs to be told what
+  folders to use for Drafts, Sent and Trash in Options --> Folder Preferences.
+  These default settings will only correctly find the Sent, Trash and Drafts
+  folders if both Gmail and SquirrelMail languages are set to English.
+  (This could be solved with implementation of extended LIST command support.)
+* In some places (Europe?), the "[Gmail]" prefix should be "[Google Mail]"
+  and "Trash" might be called "Bin"
+
+              imap_server_type = gmail
+         default_folder_prefix = <none> (is set to empty string)
+                  trash_folder = [Gmail]/Trash
+         default_move_to_trash = true
+                   sent_folder = [Gmail]/Sent Mail
+                  draft_folder = [Gmail]/Drafts
+           auto_create_special = false
+            show_prefix_option = false
+          default_sub_of_inbox = false
+show_contain_subfolders_option = false
+            optional_delimiter = /
+                 delete_folder = true
+      force_username_lowercase = false
+                        domain = gmail.com
+             imapServerAddress = imap.gmail.com
+                      imapPort = 993
+                  use_imap_tls = true
+                imap_auth_mech = login
+             smtpServerAddress = smtp.gmail.com
+                      smtpPort = 465
+                  use_smtp_tls = true
+                smtp_auth_mech = login
+               pop_before_smtp = false
+                   useSendmail = false
+
+-------------------

+ 8 - 0
src/read_body.php

@@ -964,6 +964,14 @@ if (isset($passed_ent_id) && $passed_ent_id) {
 }
 }
 $header = $message->header;
 $header = $message->header;
 
 
+// gmail does not mark messages as read when retrieving the message body
+// even though RFC 3501, section 6.4.5 (FETCH Command) says:
+// "The \Seen flag is implicitly set; if this causes the flags to change,
+// they SHOULD be included as part of the FETCH responses."
+//
+if ($imap_server_type == 'gmail') {
+    sqimap_toggle_flag($imapConnection, $passed_id, '\\Seen', true, true);
+}
 
 
 /****************************************/
 /****************************************/
 /* Block for handling incoming url vars */
 /* Block for handling incoming url vars */