@@ -33,6 +33,8 @@ public class EmailService {
3333 * @param password Password associated with the username
3434 */
3535 public EmailService (String host , int port , String username , String password ) {
36+ this .username = username ;
37+ this .password = password ;
3638 authenticator = new Authenticator (username , password );
3739 properties = new Properties ();
3840
@@ -52,7 +54,7 @@ public EmailService(String host, int port, String username, String password) {
5254 //**************************************************************************
5355 //** setHost
5456 //**************************************************************************
55- /** Used to set the hostname and port of the server
57+ /** Used to set the hostname and port of the SMTP server
5658 */
5759 public void setHost (String host , int port ){
5860 setHost (host );
@@ -63,7 +65,7 @@ public void setHost(String host, int port){
6365 //**************************************************************************
6466 //** setHost
6567 //**************************************************************************
66- /** Used to set the hostname or IP address of the server
68+ /** Used to set the hostname or IP address of the SMTP server
6769 */
6870 public void setHost (String host ){
6971 if (host ==null ){
@@ -91,7 +93,7 @@ public void setHost(String host){
9193 //**************************************************************************
9294 //** getHost
9395 //**************************************************************************
94- /** Returns the hostname or IP address of the server
96+ /** Returns the hostname or IP address of the SMTP server
9597 */
9698 public String getHost (){
9799 return host ;
@@ -101,6 +103,8 @@ public String getHost(){
101103 //**************************************************************************
102104 //** setPort
103105 //**************************************************************************
106+ /** Used to set the port of the SMTP server
107+ */
104108 public void setPort (int port ){
105109 this .port = port ;
106110 properties .setProperty ("mail.smtp.port" , port +"" );
@@ -110,14 +114,39 @@ public void setPort(int port){
110114 //**************************************************************************
111115 //** getPort
112116 //**************************************************************************
117+ /** Returns the port of the SMTP server
118+ */
113119 public Integer getPort (){
114120 return port ;
115121 }
116122
117123
124+ //**************************************************************************
125+ //** getUserName
126+ //**************************************************************************
127+ /** Returns the username used to connect to the SMTP server
128+ */
129+ public String getUserName (){
130+ return username ;
131+ }
132+
133+
134+ //**************************************************************************
135+ //** getPassword
136+ //**************************************************************************
137+ /** Returns the password used to connect to the SMTP server
138+ */
139+ public String getPassword (){
140+ return password ;
141+ }
142+
143+
118144 //**************************************************************************
119145 //** createEmail
120146 //**************************************************************************
147+ /** Returns a new email message that can be sent via the SMPT server. Note
148+ * that this method calls getSession() so you don't have to.
149+ */
121150 public EmailMessage createEmail (){
122151 return new EmailMessage (getSession ());
123152 }
@@ -126,6 +155,8 @@ public EmailMessage createEmail(){
126155 //**************************************************************************
127156 //** getSession
128157 //**************************************************************************
158+ /** Returns a new email session.
159+ */
129160 public Session getSession () {
130161 return Session .getInstance (properties , authenticator );
131162 }
0 commit comments