Package org.apache.commons.net.smtp

Examples of org.apache.commons.net.smtp.SMTPClient.disconnect()


        // After connection attempt, you should check the reply code to verify
        // success.
        System.out.print(client.getReplyString());
        int reply = client.getReplyCode();
        if (!SMTPReply.isPositiveCompletion(reply)) {
            client.disconnect();
            AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null);
            throw fault;
        }

        client.login(smtpHost);
View Full Code Here


        client.login(smtpHost);
        System.out.print(client.getReplyString());
        reply = client.getReplyCode();
        if (!SMTPReply.isPositiveCompletion(reply)) {
            client.disconnect();
            AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null);
            throw fault;
        }

        MimeMessage msg = new MimeMessage(session);
View Full Code Here

            AxisFault fault = new AxisFault("SMTP", "( Failed to send email )", null, null);
            throw fault;
        }
        System.out.print(client.getReplyString());
        client.logout();
        client.disconnect();
    }

    /**
     * Read all mime headers, returning the value of Content-Length and
     * SOAPAction.
 
View Full Code Here

        // After connection attempt, you should check the reply code to verify
        // success.
        System.out.print(client.getReplyString());
        int reply = client.getReplyCode();
        if (!SMTPReply.isPositiveCompletion(reply)) {
            client.disconnect();
            AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null);
            throw fault;
        }

        client.login(smtpHost);
View Full Code Here

        client.login(smtpHost);
        System.out.print(client.getReplyString());
        reply = client.getReplyCode();
        if (!SMTPReply.isPositiveCompletion(reply)) {
            client.disconnect();
            AxisFault fault = new AxisFault("SMTP", "( SMTP server refused connection )", null, null);
            throw fault;
        }

        String fromAddress = msgContext.getStrProp(MailConstants.FROM_ADDRESS);
View Full Code Here

            AxisFault fault = new AxisFault("SMTP", "( Failed to send email )", null, null);
            throw fault;
        }
        System.out.print(client.getReplyString());
        client.logout();
        client.disconnect();
        return id;
    }

    /**
     * Read from server using POP3
View Full Code Here

                   // First connect & login.
                   client.connect(smtpServerAddress);

                   if (!SMTPReply.isPositiveCompletion(client.getReplyCode())) {
                       client.disconnect();
                       throw new IOException("SMTP server refused connection:" +
                                             smtpServerAddress);
                   }

                   client.login(host);
View Full Code Here

                   }

                   // Logout and disconnect.
                   client.logout();
                   if (client.isConnected()) {
                       client.disconnect();
                   }
               }
               catch (UnknownHostException e) {
                   msgEntry.setDocInfo(currentFile.toString());
                   msgEntry.setMessageText("Unknown host: " + smtpServerAddress);
View Full Code Here

            assertTrue(SMTPReply.isNegativePermanent(replies[0]));
            assertTrue(SMTPReply.isPositiveCompletion(replies[1]));

            client.quit();
            assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
            client.disconnect();

            Iterator<MailEnvelope> queued = deliverHook.getDelivered().iterator();
            assertTrue(queued.hasNext());
           
            MailEnvelope env = queued.next();
View Full Code Here

            client.mail(SENDER);
            assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
           
            client.quit();
            assertTrue("Reply="+ client.getReplyString(), SMTPReply.isPositiveCompletion(client.getReplyCode()));
            client.disconnect();

            Iterator<MailEnvelope> queued = hook.getQueued().iterator();
            assertFalse(queued.hasNext());

        } finally {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.