本文整理汇总了Java中com.sun.mail.util.MailConnectException类的典型用法代码示例。如果您正苦于以下问题:Java MailConnectException类的具体用法?Java MailConnectException怎么用?Java MailConnectException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MailConnectException类属于com.sun.mail.util包,在下文中一共展示了MailConnectException类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: protocolConnect
import com.sun.mail.util.MailConnectException; //导入依赖的package包/类
protected synchronized boolean protocolConnect(String host, int portNum,
String user, String passwd) throws MessagingException {
// check for non-null values of host, password, user
if (host == null || passwd == null || user == null)
return false;
// if port is not specified, set it to value of mail.pop3.port
// property if it exists, otherwise default to 110
if (portNum == -1)
portNum = PropUtil.getIntSessionProperty(session,
"mail." + name + ".port", -1);
if (portNum == -1)
portNum = defaultPort;
this.host = host;
this.portNum = portNum;
this.user = user;
this.passwd = passwd;
try {
port = getPort(null);
} catch (EOFException eex) {
throw new AuthenticationFailedException(eex.getMessage());
} catch (SocketConnectException scex) {
throw new MailConnectException(scex);
} catch (IOException ioex) {
throw new MessagingException("Connect failed", ioex);
}
return true;
}