From 7d8cfb1eccb2b61c75aa32850cc294b33b220ccc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 13 Sep 2009 16:08:48 +0000 Subject: [PATCH] FR [1868756] - Enable smtp gmail support https://sourceforge.net/tracker/index.php?func=detail&aid=1868756&group_id=176962&atid=879335 Recommit revision 10158 implement gmail support in RUN_setup --- .../org/compiere/install/ConfigurationData.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/install/src/org/compiere/install/ConfigurationData.java b/install/src/org/compiere/install/ConfigurationData.java index 1d48d61573..ebe8e33ae8 100644 --- a/install/src/org/compiere/install/ConfigurationData.java +++ b/install/src/org/compiere/install/ConfigurationData.java @@ -560,9 +560,10 @@ public class ConfigurationData private boolean testMailServer(InetAddress mailServer, InternetAddress adminEMail, String mailUser, String mailPassword) { + boolean isGmail = mailServer.getHostName().equalsIgnoreCase("smtp.gmail.com"); boolean smtpOK = false; boolean imapOK = false; - if (testPort (mailServer, 25, true)) + if (testPort (mailServer, isGmail ? 587 : 25, true)) { log.config("OK: SMTP Server contacted"); smtpOK = true; @@ -570,11 +571,11 @@ public class ConfigurationData else log.info("SMTP Server NOT available"); // - if (testPort (mailServer, 110, true)) + if (testPort (mailServer, isGmail ? 995 : 110, true)) log.config("OK: POP3 Server contacted"); else log.info("POP3 Server NOT available"); - if (testPort (mailServer, 143, true)) + if (testPort (mailServer, isGmail ? 993 : 143, true)) { log.config("OK: IMAP4 Server contacted"); imapOK = true; @@ -626,6 +627,11 @@ public class ConfigurationData props.put("mail.host", mailServer.getHostName()); props.put("mail.user", mailUser); props.put("mail.smtp.auth", "true"); + if (isGmail) { + props.put("impa.smtp.port", "993"); + props.put("mail.store.protocol", "imaps"); + } + log.config("Connecting to " + mailServer.getHostName()); // Session session = null; @@ -637,7 +643,7 @@ public class ConfigurationData session.setDebug (CLogMgt.isLevelFinest()); log.config("Session=" + session); // Connect to Store - store = session.getStore("imap"); + store = session.getStore(isGmail ? "imaps" : "imap"); log.config("Store=" + store); } catch (NoSuchProviderException nsp)