From a798d8b2a36f3f7d30e58f350df31e31f9fefaf8 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sat, 13 Feb 2010 23:11:28 +0000 Subject: [PATCH] Added ability to configure Google Mail (Gmail) as the mail server behind SquirrelMail git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13907 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 47 ++++++++++++++++++++++++++++++++++++- doc/ChangeLog | 4 +++- doc/presets.txt | 60 +++++++++++++++++++++++++++++++++++++++++++++++ src/read_body.php | 8 +++++++ 4 files changed, 117 insertions(+), 2 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index 408e57ec..65966aab 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -545,7 +545,8 @@ $list_supported_imap_servers = " 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 ) { @@ -5371,6 +5372,50 @@ sub set_defaults { $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"; + $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 = ""; + $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" ) { $continue = 1; } else { diff --git a/doc/ChangeLog b/doc/ChangeLog index ee541246..1b7accf1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -333,8 +333,10 @@ Version 1.5.2 - SVN - Encoded From headers now properly quoted (#2830141). - Multibyte strings (notably subjects) are now handled correctly (#2824813, #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. + - Added the ability to configure Google Mail (Gmail) as the mail server + behind SquirrelMail. Version 1.5.1 (branched on 2006-02-12) -------------------------------------- diff --git a/doc/presets.txt b/doc/presets.txt index 54ff6e42..5762a129 100644 --- a/doc/presets.txt +++ b/doc/presets.txt @@ -230,3 +230,63 @@ show_contain_subfolders_option = false * 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 +* 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 = (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 + +------------------- diff --git a/src/read_body.php b/src/read_body.php index 59bd3002..8d9bfb14 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -964,6 +964,14 @@ if (isset($passed_ent_id) && $passed_ent_id) { } $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 */ -- 2.25.1