Gmail

Paul Lesniewski <[email protected]>
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <[email protected]>
All,

  It has come to my attention that we could add a list of required
configuration settings for using Gmail as the IMAP/SMTP server behind
SquirrelMail.  Google is a fairly controversial company, second only
to Microsoft these days, so I'm not sure if we want to do that or not.
 OTOH, we list exchange and some other IMAP servers that represent
for-profit entities, which is why I think ultimately, it's probably
OK.  Gmail is somewhat non-standard in that it's a hosted IMAP server,
but it is an IMAP server nonetheless.

  If we add Gmail, we need at least one Gmail-specific fix in the
code, wherein when FETCHing a message body, their IMAP server does not
set the Seen flag.  The fix is simple.

  Thoughts?

  Below are the settings that I fiddled with and seemed to work for
the most part.  Attached is the full proposed patch for STABLE.
Please help fix and test.

imap_server_type = gmail
default_folder_prefix = <none> (is set to empty string)
trash_folder = [Gmail]/Trash
sent_folder = [Gmail]/Sent Mail
draft_folder = [Gmail]/Drafts
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

-- 
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
squirrelmail-gmail-configuration.diff (application/octet-stream, 5.7 KB)
Index: doc/ChangeLog
===================================================================
--- doc/ChangeLog	(revision 13902)
+++ doc/ChangeLog	(working copy)
@@ -16,6 +16,8 @@
   - Encoded From headers now properly quoted (#2830141).
   - Multibyte strings (notably subjects) are now handled correctly (#2824813,
     #2925731).
+  - Added ability to configure Google Mail (Gmail) as the mail server behind
+    SquirrelMail.
 
 Version 1.4.20 RC2 - 17 Aug 2009
 --------------------------------
Index: doc/presets.txt
===================================================================
--- doc/presets.txt	(revision 13876)
+++ doc/presets.txt	(working copy)
@@ -231,3 +231,52 @@
 
 
 * 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 and away from the other system folders
+  (drafts/sent/trash)
+
+              imap_server_type = gmail
+         default_folder_prefix = <none> (is set to empty string)
+                  trash_folder = [Gmail]/Trash
+                   sent_folder = [Gmail]/Sent Mail
+                  draft_folder = [Gmail]/Drafts
+            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
+
+-------------------
Index: config/conf.pl
===================================================================
--- config/conf.pl	(revision 13876)
+++ config/conf.pl	(working copy)
@@ -396,7 +396,8 @@
     "    hmailserver = hMailServer\n" .
     "    macosx      = Mac OS X Mailserver\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 ) {
@@ -3751,6 +3752,31 @@
             $message = "\nIf you use IMAPdir depot, you must set default folder prefix to empty string.\n";
 
             $continue = 1;
+        } elsif ( $server eq "gmail" ) {
+            $imap_server_type               = "gmail";
+            $default_folder_prefix          = "";
+            $trash_folder                   = "[Gmail]/Trash";
+            $sent_folder                    = "[Gmail]/Sent Mail";
+            $draft_folder                   = "[Gmail]/Drafts";
+            $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;
         } elsif ( $server eq "quit" ) {
             $continue = 1;
         } else {
Index: src/read_body.php
===================================================================
--- src/read_body.php	(revision 13876)
+++ src/read_body.php	(working copy)
@@ -801,6 +802,15 @@
 }
 $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);
+}
+
 do_hook('html_top');
 
 /****************************************/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.