Session getProviders Example
Session class getProviders example. This example shows you how to use getProviders method.
Session class getProviders example. public Provider[] getProviders() This method returns an array of all the implementations installed via the javamail.[default.]providers files that can be loaded using the ClassLoader available to this application.
Here is the code
/*
* @ # GetProviders.java
* A class repersenting use to GetProviders method
* of Session class in javax.mail package
* version 07 July 2008
* author Rose India
*/
package session;
import java.util.*;
import javax.mail.*;
public class GetProviders {
public static void main(String args[]) throws Exception {
Properties properties = System.getProperties();
Session session = Session.getDefaultInstance(properties, null);
Provider[] provider = session.getProviders();
for (int i = 0; i < provider.length; i++) {
System.out.println("protocol : " + provider[i].getProtocol());
}
}
} |
Output
protocol : imap
protocol : imaps
protocol : smtp
protocol : smtps
protocol : pop3
protocol : pop3s |
|