Sample code for 30+ languages & platforms
Java

Verify Connectivity to the POP3 Server

See more POP3 Examples

Demonstrates the Chilkat MailMan.VerifyPopConnection method, which tests whether a TCP/IP connection can be established with the configured POP3 server. It verifies connectivity only — it does not authenticate. This example configures the POP3 host and checks whether it can be reached.

Background: This is the POP3 counterpart to VerifySmtpConnection. It answers the first diagnostic question — can the client reach the POP3 server on the configured host and port and complete the TLS handshake? A failure here indicates a network, firewall, DNS, port, or certificate problem rather than a credentials issue, which VerifyPopLogin checks next.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.MailMan;

public class ChilkatExample {

    public static void main(String[] args) {
        // Demonstrates the MailMan.VerifyPopConnection method, which tests whether a TCP/IP
        // connection can be established with the configured POP3 server.  It verifies connectivity
        // only (it does not authenticate).

        MailMan mailman = new MailMan();

        // Configure the POP3 server connection.
        mailman.setMailHost("pop.example.com");
        mailman.setMailPort(995);
        mailman.setPopSsl(true);

        // Test connectivity to the POP3 server.
        boolean connected = mailman.verifyPopConnection();

        if (connected) {
            System.out.println("Successfully connected to the POP3 server.");
        } else {
            System.out.println("Could not connect to the POP3 server.");
        }
    }
}