Read the complete article on how to connect to PoP3 servers in Java: https://blog.aspose.com/2022/05/13/connect-to-pop3-servers-in-java/
Last active
May 13, 2022 05:40
-
-
Save aspose-com-gists/7c5b8a4ddb79171f1b12ab6a777674d7 to your computer and use it in GitHub Desktop.
Connect to POP3 Servers in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an instance of HttpProxy | |
HttpProxy proxy = new HttpProxy("18.222.124.59", 8080); | |
// Create Pop3Client | |
try (Pop3Client client = new Pop3Client("imap.domain.com", "username", "password")) { | |
// Set HTTP proxy | |
client.setProxy(proxy); | |
// Access mailbox | |
Pop3MailboxInfo mailboxInfo = client.getMailboxInfo(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an instance of the Pop3Client class | |
Pop3Client client = new Pop3Client("pop.domain.com", "username", "password"); | |
// Set proxy address, port and proxy | |
String proxyAddress = "192.168.203.142"; | |
int proxyPort = 1080; | |
SocksProxy proxy = new SocksProxy(proxyAddress, proxyPort, SocksVersion.SocksV5); | |
client.setProxy(proxy); | |
// Access mailbox | |
Pop3MailboxInfo mailboxInfo = client.getMailboxInfo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an instance of the Pop3Client class | |
Pop3Client client = new Pop3Client(); | |
// Specify host, username and password, Port and SecurityOptions for your client | |
client.setHost("pop.gmail.com"); | |
client.setUsername("your.username@gmail.com"); | |
client.setPassword("your.password"); | |
client.setPort(995); | |
client.setSecurityOptions(SecurityOptions.Auto); | |
System.out.println("Connecting to POP3 server using SSL."); | |
// Access mailbox |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment