/** * Send the command to the server and return the response code * from the server. * * @param cmd the command * @return the response code * @exception MessagingException for failures * @since JavaMail 1.4.1 */ public synchronized int simpleCommand(String cmd) throws MessagingException { sendCommand(cmd); return readServerResponse(); }
/** * Send the command to the server and return the response code * from the server. * * @param cmd the command * @return the response code * @exception MessagingException for failures * @since JavaMail 1.4.1 */ public synchronized int simpleCommand(String cmd) throws MessagingException { sendCommand(cmd); return readServerResponse(); }
/** * Send the command to the server and return the response code * from the server. * * @param cmd the command * @return the response code * @exception MessagingException for failures * @since JavaMail 1.4.1 */ protected int simpleCommand(byte[] cmd) throws MessagingException { assert Thread.holdsLock(this); sendCommand(cmd); return readServerResponse(); }
/** * Send the command to the server and return the response code * from the server. * * @param cmd the command * @return the response code * @exception MessagingException for failures * @since JavaMail 1.4.1 */ protected int simpleCommand(byte[] cmd) throws MessagingException { assert Thread.holdsLock(this); sendCommand(cmd); return readServerResponse(); }
/** * Send the specified bytes using the BDAT command. */ private void bdat(byte[] b, int off, int len, boolean last) throws IOException { if (len > 0 || last) { try { if (last) sendCommand("BDAT " + len + " LAST"); else sendCommand("BDAT " + len); out.write(b, off, len); out.flush(); int ret = readServerResponse(); if (ret != 250) throw new IOException(lastServerResponse); } catch (MessagingException mex) { throw new IOException("BDAT write exception", mex); } } } }
/** * Send the command to the server. If the expected response code * is not received, throw a MessagingException. * * @param cmd the command to send * @param expect the expected response code (-1 means don't care) * @exception MessagingException for failures * @since JavaMail 1.4.1 */ public synchronized void issueCommand(String cmd, int expect) throws MessagingException { sendCommand(cmd); // if server responded with an unexpected return code, // throw the exception, notifying the client of the response int resp = readServerResponse(); if (expect != -1 && resp != expect) throw new MessagingException(lastServerResponse); }
/** * Send the command to the server. If the expected response code * is not received, throw a MessagingException. * * @param cmd the command to send * @param expect the expected response code (-1 means don't care) * @exception MessagingException for failures * @since JavaMail 1.4.1 */ public synchronized void issueCommand(String cmd, int expect) throws MessagingException { sendCommand(cmd); // if server responded with an unexpected return code, // throw the exception, notifying the client of the response int resp = readServerResponse(); if (expect != -1 && resp != expect) throw new MessagingException(lastServerResponse); }
cmd = "EHLO"; sendCommand(cmd); int resp = readServerResponse(); if (resp == 250) {
cmd = "EHLO"; sendCommand(cmd); int resp = readServerResponse(); if (resp == 250) {
if ((ret = readServerResponse()) != expect) {
if ((ret = readServerResponse()) != expect) {
if ((r = readServerResponse()) != 220) { serverSocket.close(); serverSocket = null;
/** * Close the Transport and terminate the connection to the server. */ public synchronized void close() throws MessagingException { if (!super.isConnected()) // Already closed. return; try { if (serverSocket != null) { sendCommand("QUIT"); if (quitWait) { int resp = readServerResponse(); if (resp != 221 && resp != -1 && logger.isLoggable(Level.FINE)) logger.fine("QUIT failed with " + resp); } } } finally { closeConnection(); } }
if ((r = readServerResponse()) != 220) { serverSocket.close(); serverSocket = null;
/** * Close the Transport and terminate the connection to the server. */ @Override public synchronized void close() throws MessagingException { if (!super.isConnected()) // Already closed. return; try { if (serverSocket != null) { sendCommand("QUIT"); if (quitWait) { int resp = readServerResponse(); if (resp != 221 && resp != -1 && logger.isLoggable(Level.FINE)) logger.fine("QUIT failed with " + resp); } } } finally { closeConnection(); } }
else sendCommand("NOOP"); int resp = readServerResponse();
else sendCommand("NOOP"); int resp = readServerResponse();
retCode = readServerResponse(); switch (retCode) { case 250: case 251:
if ((r = readServerResponse()) != 220) { serverSocket.close(); serverSocket = null;
if ((r = readServerResponse()) != 220) { serverSocket.close(); serverSocket = null;