|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 |
public void init(String user, String passwd, String server, int port)
user
- the e-mail ID that the server uses to receive mail.passwd
- the password for the mail accountserver
- the name of the mail serverport
- the port number the mail server uses to receive mail;
the default port number is 110 (the default for a POP3 server).// Initialize it acct.init("user1", "password", "mailserver", 110);
public String getUserName()
// Get the user name String userName = acct.getUserName();
public String getServerName()
// Get the name of the mail server String serverName = acct.getServerName();
public int getPort()
// Get the port int port = acct.getPort();
public String getPassword()
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.
// 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();
public void setUserName(String user)
user
- the name of the user// Set the name of the user acct.setUserName("user2");
public void setPassword(String passwd)
passwd
- the mail account password// Set the password acct.setPassword("newpassword");
public void setServerName(String server)
server
- the name of the mail server.// Set the name of the mail server acct.setServerName("mail_server");
public void setPort(int port)
port
- the port number// Set the port acct.setPort(110);
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |