p = new Protocol(host, portNum, logger, session.getProperties(), "mail." + name, isSSL); if (p.hasCapability("STLS")) { if (p.stls()) { p.setCapabilities(p.capa()); } else if (requireStartTLS) { logger.fine("STLS required but failed"); try { p.quit(); } catch (IOException ioex) { } finally { logger.fine("STLS required but not supported"); try { p.quit(); } catch (IOException ioex) { } finally { capabilities = p.getCapabilities(); // save for later, may be null usingSSL = p.isSSL(); // in case anyone asks if ((msg = p.login(user, passwd)) != null) { try { p.quit(); } catch (IOException ioex) { } finally {
if (noauthdebug && isTracing()) { logger.fine("authentication command trace suppressed"); suspendTracing(); dpw = getDigest(password); if (apopChallenge != null && dpw != null) { r = simpleCommand("APOP " + user + " " + dpw); } else if (batch) { String cmd = "USER " + user; batchCommandStart(cmd); issueCommand(cmd); cmd = "PASS " + password; batchCommandContinue(cmd); issueCommand(cmd); r = readResponse(); if (!r.ok) { String err = r.data != null ? r.data : "USER command failed"; readResponse(); // read and ignore PASS response batchCommandEnd(); return err; r = readResponse(); batchCommandEnd(); } else { r = simpleCommand("USER " + user); if (!r.ok) return r.data != null ? r.data : "USER command failed"; r = simpleCommand("PASS " + password);
/** * Return the raw results of the POP3 LIST command with no arguments. * * @return InputStream containing results * @exception IllegalStateException if the folder isn't open * @exception IOException for I/O errors talking to the server * @exception MessagingException for other errors * @since JavaMail 1.3.3 */ public synchronized InputStream listCommand() throws MessagingException, IOException { checkOpen(); return port.list(); }
/** * Return the size of all messages using the LIST command. */ synchronized InputStream list() throws IOException { Response r = multilineCommand("LIST", 128); // 128 == output size est return r.bytes; }
public synchronized boolean isOpen() { if (!opened) return false; try { if (!port.noop()) throw new IOException("NOOP failed"); } catch (IOException ioex) { try { close(false); } catch (MessagingException mex) { // ignore it } finally { return false; } } return true; }
if (folder.logger.isLoggable(Level.FINE)) folder.logger.fine("streaming msg " + msgnum); if (!folder.getProtocol().retr(msgnum, os)) { expunged = true; throw new MessageRemovedException("can't retrieve message #" +
protected void finalize() throws Throwable { try { if (socket != null) // Forgot to logout ?! quit(); } finally { super.finalize(); } }
/** * Login to the server, using the USER and PASS commands. */ synchronized String login(String user, String password) throws IOException { Response r; String dpw = null; if (apopChallenge != null) dpw = getDigest(password); if (apopChallenge != null && dpw != null) { r = simpleCommand("APOP " + user + " " + dpw); } else { r = simpleCommand("USER " + user); if (!r.ok) return r.data != null ? r.data : "USER command failed"; r = simpleCommand("PASS " + password); } if (!r.ok) return r.data != null ? r.data : "login failed"; return null; }
/** * Return the raw results of the POP3 LIST command with no arguments. * * @return InputStream containing results * @exception IllegalStateException if the folder isn't open * @exception IOException for I/O errors talking to the server * @exception MessagingException for other errors * @since JavaMail 1.3.3 */ public synchronized InputStream listCommand() throws MessagingException, IOException { checkOpen(); return port.list(); }
/** * Return the message header and the first n lines of the message. */ synchronized InputStream top(int msg, int n) throws IOException { Response r = multilineCommand("TOP " + msg + " " + n, 0); return r.bytes; }
@Override public synchronized boolean isOpen() { if (!opened) return false; try { if (!port.noop()) throw new IOException("NOOP failed"); } catch (IOException ioex) { try { close(false); } catch (MessagingException mex) { // ignore it } return false; } return true; }
if (folder.logger.isLoggable(Level.FINE)) folder.logger.fine("streaming msg " + msgnum); if (!folder.getProtocol().retr(msgnum, os)) { expunged = true; throw new MessageRemovedException("can't retrieve message #" +
@Override protected void finalize() throws Throwable { try { if (socket != null) // Forgot to logout ?! quit(); } finally { super.finalize(); } }