Hi Carlos!

I try apply your self recommendation, so I revert this commit because is a specific implementation.

My recommendation is you should add  a combobox with email protocol (SMTP,POP3,IMAP4) and email port

with this approach you can solve any Email Server configuration  even servers that are behind a proxy.
http://sourceforge.net/tracker/index.php?func=detail&aid=1868756&group_id=176962&atid=879335

kind regards
Victor Perez
www.e-evolution.com
This commit is contained in:
vpj-cd 2009-09-13 06:55:35 +00:00
parent c237974404
commit cd6cc98352
1 changed files with 4 additions and 10 deletions

View File

@ -560,10 +560,9 @@ public class ConfigurationData
private boolean testMailServer(InetAddress mailServer, InternetAddress adminEMail, private boolean testMailServer(InetAddress mailServer, InternetAddress adminEMail,
String mailUser, String mailPassword) String mailUser, String mailPassword)
{ {
boolean isGmail = mailServer.getHostName().equalsIgnoreCase("smtp.gmail.com");
boolean smtpOK = false; boolean smtpOK = false;
boolean imapOK = false; boolean imapOK = false;
if (testPort (mailServer, isGmail ? 587 : 25, true)) if (testPort (mailServer, 25, true))
{ {
log.config("OK: SMTP Server contacted"); log.config("OK: SMTP Server contacted");
smtpOK = true; smtpOK = true;
@ -571,11 +570,11 @@ public class ConfigurationData
else else
log.info("SMTP Server NOT available"); log.info("SMTP Server NOT available");
// //
if (testPort (mailServer, isGmail ? 995 : 110, true)) if (testPort (mailServer, 110, true))
log.config("OK: POP3 Server contacted"); log.config("OK: POP3 Server contacted");
else else
log.info("POP3 Server NOT available"); log.info("POP3 Server NOT available");
if (testPort (mailServer, isGmail ? 993 : 143, true)) if (testPort (mailServer, 143, true))
{ {
log.config("OK: IMAP4 Server contacted"); log.config("OK: IMAP4 Server contacted");
imapOK = true; imapOK = true;
@ -627,11 +626,6 @@ public class ConfigurationData
props.put("mail.host", mailServer.getHostName()); props.put("mail.host", mailServer.getHostName());
props.put("mail.user", mailUser); props.put("mail.user", mailUser);
props.put("mail.smtp.auth", "true"); 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()); log.config("Connecting to " + mailServer.getHostName());
// //
Session session = null; Session session = null;
@ -643,7 +637,7 @@ public class ConfigurationData
session.setDebug (CLogMgt.isLevelFinest()); session.setDebug (CLogMgt.isLevelFinest());
log.config("Session=" + session); log.config("Session=" + session);
// Connect to Store // Connect to Store
store = session.getStore(isGmail ? "imaps" : "imap"); store = session.getStore("imap");
log.config("Store=" + store); log.config("Store=" + store);
} }
catch (NoSuchProviderException nsp) catch (NoSuchProviderException nsp)