Commit 45fe7a15 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Default to localhost.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1360 b35dd754-fafc-0310-a699-88a17e54d16e
parent 823bb9c9
...@@ -52,7 +52,7 @@ import javax.mail.internet.*; ...@@ -52,7 +52,7 @@ import javax.mail.internet.*;
* *
* This class is configured with a set of Jive properties:<ul> * This class is configured with a set of Jive properties:<ul>
* <li><tt>mail.smtp.host</tt> -- the host name of your mail server, i.e. * <li><tt>mail.smtp.host</tt> -- the host name of your mail server, i.e.
* mail.yourhost.com * mail.yourhost.com. The default value is "localhost".
* <li><tt>mail.smtp.port</tt> -- an optional property to change the smtp * <li><tt>mail.smtp.port</tt> -- an optional property to change the smtp
* port used from the default of 25. * port used from the default of 25.
* <li><tt>mail.smtp.username</tt> -- an optional property to change the * <li><tt>mail.smtp.username</tt> -- an optional property to change the
...@@ -90,7 +90,7 @@ public class EmailService { ...@@ -90,7 +90,7 @@ public class EmailService {
executor = new ThreadPoolExecutor(0, 5, 60, executor = new ThreadPoolExecutor(0, 5, 60,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
host = JiveGlobals.getProperty("mail.smtp.host"); host = JiveGlobals.getProperty("mail.smtp.host", "localhost");
port = JiveGlobals.getIntProperty("mail.smtp.port", 25); port = JiveGlobals.getIntProperty("mail.smtp.port", 25);
username = JiveGlobals.getProperty("mail.smtp.username"); username = JiveGlobals.getProperty("mail.smtp.username");
password = JiveGlobals.getProperty("mail.smtp.password"); password = JiveGlobals.getProperty("mail.smtp.password");
...@@ -269,8 +269,7 @@ public class EmailService { ...@@ -269,8 +269,7 @@ public class EmailService {
} }
/** /**
* Returns the SMTP host (e.g. mail.example.com). The host is <tt>null</tt> by * Returns the SMTP host (e.g. mail.example.com). The default value is "localhost".
* default, but must be set before email can be sent.
* *
* @return the SMTP host. * @return the SMTP host.
*/ */
...@@ -279,8 +278,7 @@ public class EmailService { ...@@ -279,8 +278,7 @@ public class EmailService {
} }
/** /**
* Sets the SMTP host (e.g. mail.example.com). The host is <tt>null</tt> by * Sets the SMTP host (e.g. mail.example.com). The default value is "localhost".
* default, but must be set before email can be sent.
* *
* @param host the SMTP host. * @param host the SMTP host.
*/ */
...@@ -291,7 +289,8 @@ public class EmailService { ...@@ -291,7 +289,8 @@ public class EmailService {
} }
/** /**
* Returns the port number used when connecting to the SMTP server. The default port is 25. * Returns the port number used when connecting to the SMTP server. The default
* port is 25.
* *
* @return the SMTP port. * @return the SMTP port.
*/ */
...@@ -306,6 +305,9 @@ public class EmailService { ...@@ -306,6 +305,9 @@ public class EmailService {
* @param port the SMTP port number. * @param port the SMTP port number.
*/ */
public void setPort(int port) { public void setPort(int port) {
if (port < 0) {
throw new IllegalArgumentException("Invalid port value: " + port);
}
this.port = port; this.port = port;
JiveGlobals.setProperty("mail.smtp.port", Integer.toString(port)); JiveGlobals.setProperty("mail.smtp.port", Integer.toString(port));
session = null; session = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment