SilverStream
Application Server 3.5

com.sssw.rts.adminapi
Interface AgiAdmMailAccount

All Known Subinterfaces:
AgiMailAccount

public interface AgiAdmMailAccount

Implemented by objects that represent mail accounts that can be set up on the server.

See the description of AgiAdmMailAccount.getPassword() for a complete code example.

See Also:
AgiAdmServer

Method Summary
 String getPassword()
          Return the password for the mail account.
 int getPort()
          Return the port the mail server uses to poll for mail.
 String getServerName()
          Return the name of the mail server.
 String getUserName()
          Return the user name.
 void init(String user, String passwd, String server, int port)
          Initialize the mail account object.
 void setPassword(String passwd)
          Set the password of the mail account.
 void setPort(int port)
          Set the port number the mail server uses to receive mail.
 void setServerName(String server)
          Set the name of the mail server.
 void setUserName(String user)
          Set the user name.
 

Method Detail

init

public void init(String user,
                 String passwd,
                 String server,
                 int port)
Initialize the mail account object.
Parameters:
user - the e-mail ID that the server uses to receive mail.
passwd - the password for the mail account
server - the name of the mail server
port - the port number the mail server uses to receive mail; the default port number is 110 (the default for a POP3 server).
Example:
 // Initialize it
 acct.init("user1", "password", "mailserver", 110);
 

getUserName

public String getUserName()
Return the user name.
Example:
 // Get the user name
 String userName = acct.getUserName();
 

getServerName

public String getServerName()
Return the name of the mail server.
Example:
 // Get the name of the mail server
 String serverName = acct.getServerName();
 

getPort

public int getPort()
Return the port the mail server uses to poll for mail.
Example:
// Get the port
 int port = acct.getPort();
 

getPassword

public String getPassword()
Return the password for the mail account.

NOTE: This method is provided only so that the caller can set up the password via init() and retrieve it later on when they're about to set mail accounts. For security reasons, the password is not filled in when the mail account information is retrieved from the server. In other words, you can only retrieve a password through this method if you are the creator.

Example:
 // Enumerating existing mail accounts (technique 1) 
 
 AgiAdmServer server = AgAdmin.getServer("myserver", -1); 
 // Enumerate mail accounts currently set up on the server "myserver". 
 Enumeration mailAccounts = server.getMailAccounts(); 
 Vector vAccounts = new Vector(); 
 while(mailAccounts.hasMoreElements()) 
 { 
 AgiAdmMailAccount acct = (AgiAdmMailAccount)mailAccounts.nextElement(); 
 int port = acct.getPort(); 
 String mailServer = acct.getServerName(); 
 String user = getUserName(); 
 // Note: you cannot get the password (for security reasons) 
 // ... do something with the account info ... 
 // Now, add the account to a vector (this is useful if you want to make changes to 
 // the list of mail accounts and later send it to the server). 
 vAccounts.addElement(acct); 
 } 
 
 // Setting up a new mail account (technique 2) 
 
 AgiAdmServer server = AgAdmin.getServer("myserver", -1); 
 // Create a new mail account object. 
 AgiAdmMailAccount acct = server.getMailAccountObject(); 
 acct.setPort(110); 
 acct.setServerName("mailserver"); 
 acct.setUserName("JBrown"); 
 acct.setPassword("mypassword"); 
 // ... 
 // You can retrieve the password that you just set on the account 
 // that you are creating. 
 String password = acct.getPassword(); 
 // You can use the init method instead of the four "set" methods: 
 acct.init("JBrown", "mypassword", "mailserver", 110); 
 // Add the account to the current list of mail accounts that you got in 
 // technique 1. 
 vAccounts.addElement(acct); 
 // send the new mail account list to the server 
 server.setMailAccounts(vAccounts.elements()); 
 server.saveChanges(); 
 
 

setUserName

public void setUserName(String user)
Set the user name.
Parameters:
user - the name of the user
Example:
 // Set the name of the user
 acct.setUserName("user2");
 

setPassword

public void setPassword(String passwd)
Set the password of the mail account.
Parameters:
passwd - the mail account password
Example:
 // Set the password
 acct.setPassword("newpassword");
 

setServerName

public void setServerName(String server)
Set the name of the mail server.
Parameters:
server - the name of the mail server.
Example:
 // Set the name of the mail server
 acct.setServerName("mail_server");
 

setPort

public void setPort(int port)
Set the port number the mail server uses to receive mail.
Parameters:
port - the port number
Example:
 // Set the port
 acct.setPort(110);
 

SilverStream
Application Server 3.5