org.apache.commons.net.smtp
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.apache.commons.net.smtp(Showing top 15 results out of 315)

origin: commons-net/commons-net

/**
 * Removes a ProtocolCommandListener.
 *
 * Delegates this incorrectly named method - removeProtocolCommandistener (note the missing "L")- to
 * the correct method {@link SocketClient#removeProtocolCommandListener}
 * @param listener The ProtocolCommandListener to remove
 */
public void removeProtocolCommandistener(org.apache.commons.net.ProtocolCommandListener listener){
  removeProtocolCommandListener(listener);
}
origin: commons-net/commons-net

/**
 *
 * @param command the command to send (as an int defined in {@link SMPTCommand})
 * @param args the command arguments, may be {@code null}
 * @param includeSpace if {@code true}, add a space between the command and its arguments
 * @return the reply code
 * @throws IOException
 */
private int __sendCommand(int command, String args, boolean includeSpace)
throws IOException
{
  return __sendCommand(SMTPCommand.getCommand(command), args, includeSpace);
}
origin: apache/james-project

  @Override
  public void close() throws IOException {
    smtpClient.disconnect();
  }
}
origin: apache/james-project

public SMTPMessageSender connect(String ip, int port) throws IOException {
  smtpClient.connect(ip, port);
  return this;
}
origin: org.apache.james.protocols/protocols-smtp

protected SMTPClient createClient() {
  return new SMTPClient();
}
origin: commons-net/commons-net

@Test
public void testToStringNoSubject() {
  SimpleSMTPHeader hdr = new SimpleSMTPHeader("from@here.invalid", "to@there.invalid", null);
  assertNotNull(hdr);
  // Note that the DotTerminatedMessageWriter converts LF to CRLF
  assertEquals("From: from@here.invalid\nTo: to@there.invalid\n\n", checkDate(hdr.toString()));
}
origin: openstack-infra/gerrit

public void enableSSL(final boolean verify) {
 _socketFactory_ = sslFactory(verify);
}
origin: commons-net/commons-net

/**
 * The TLS command execution.
 * @throws IOException If an I/O error occurs while sending
 * the command or performing the negotiation.
 * @return TRUE if the command and negotiation succeeded.
 */
public boolean execTLS() throws IOException
{
  if (!SMTPReply.isPositiveCompletion(sendCommand("STARTTLS")))
  {
    return false;
    //throw new SSLException(getReplyString());
  }
  performSSLNegotiation();
  return true;
}
origin: commons-net/commons-net

/***
 * Logout of the SMTP server by sending the QUIT command.
 * <p>
 * @return True if successfully completed, false if not.
 * @throws SMTPConnectionClosedException
 *      If the SMTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send SMTP reply code 421.  This exception may be caught either
 *      as an IOException or independently as itself.
 * @throws IOException  If an I/O error occurs while either sending a
 *      command to the server or receiving a reply from the server.
 ***/
public boolean logout() throws IOException
{
  return SMTPReply.isPositiveCompletion(quit());
}
origin: commons-net/commons-net

@Test
public void testToString() {
  assertNotNull(header);
  // Note that the DotTerminatedMessageWriter converts LF to CRLF
  assertEquals("From: from@here.invalid\nTo: to@there.invalid\nSubject: Test email\n\n", checkDate(header.toString()));
}
origin: openstack-infra/gerrit

private boolean authPlain(String smtpUser, String smtpPass) throws UnsupportedEncodingException,
  IOException {
 String token = '\0' + smtpUser + '\0' + smtpPass;
 String cmd = "PLAIN " + encodeBase64(token.getBytes(UTF_8));
 return SMTPReply.isPositiveCompletion(sendCommand("AUTH", cmd));
}
origin: commons-net/commons-net

@Test
public void testToStringAddHeader() {
  SimpleSMTPHeader hdr = new SimpleSMTPHeader("from@here.invalid", null, null);
  assertNotNull(hdr);
  hdr.addHeaderField("X-Header1", "value 1");
  hdr.addHeaderField("X-Header2", "value 2");
  // Note that the DotTerminatedMessageWriter converts LF to CRLF
  assertEquals("X-Header1: value 1\nX-Header2: value 2\nFrom: from@here.invalid\n\n", checkDate(hdr.toString()));
}
origin: commons-net/commons-net

/***
 * Sends a NOOP command to the SMTP server.  This is useful for preventing
 * server timeouts.
 * <p>
 * @return True if successfully completed, false if not.
 * @throws SMTPConnectionClosedException
 *      If the SMTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send SMTP reply code 421.  This exception may be caught either
 *      as an IOException or independently as itself.
 * @throws IOException  If an I/O error occurs while either sending a
 *      command to the server or receiving a reply from the server.
 ***/
public boolean sendNoOp() throws IOException
{
  return SMTPReply.isPositiveCompletion(noop());
}
origin: commons-net/commons-net

/***
 * Aborts the current mail transaction, resetting all server stored
 * sender, recipient, and mail data, cleaing all buffers and tables.
 * <p>
 * @return True if successfully completed, false if not.
 * @throws SMTPConnectionClosedException
 *      If the SMTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send SMTP reply code 421.  This exception may be caught either
 *      as an IOException or independently as itself.
 * @throws IOException  If an I/O error occurs while either sending a
 *      command to the server or receiving a reply from the server.
 ***/
public boolean reset() throws IOException
{
  return SMTPReply.isPositiveCompletion(rset());
}
origin: commons-net/commons-net

@Test
public void testToStringNoTo() {
  SimpleSMTPHeader hdr = new SimpleSMTPHeader("from@here.invalid", null, null);
  assertNotNull(hdr);
  // Note that the DotTerminatedMessageWriter converts LF to CRLF
  assertEquals("From: from@here.invalid\n\n", checkDate(hdr.toString()));
}
org.apache.commons.net.smtp

Most used classes

  • SMTPClient
    SMTPClient encapsulates all the functionality necessary to send files through an SMTP server. This c
  • SMTPReply
    SMTPReply stores a set of constants for SMTP reply codes. To interpret the meaning of the codes, fam
  • AuthenticatingSMTPClient
    An SMTP Client class with authentication support (RFC4954).
  • SimpleSMTPHeader
    This class is used to construct a bare minimum acceptable header for an email message. To construct
  • SMTPSClient
    SMTP over SSL processing. Copied from FTPSClient.java and modified to suit SMTP. If implicit mode is
  • AuthenticatingSMTPClient$AUTH_METHOD,
  • RelayPath,
  • SMTP,
  • SMTPCommand,
  • SMTPConnectionClosedException,
  • SimpleSMTPHeaderTestCase

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)