简体   繁体   English

如何使用Java(而非Javamail)连接到电子邮件

[英]how do you connect to your email using java (not javamail)

Is there a way to connect to your email inbox in java (using netbeans IDE) without the use of JavaMail API? 有没有一种方法(不使用JavaMail API)连接到Java中的电子邮件收件箱(使用Netbeans IDE)? I have been searching for a way to do it without the use of that API as I am trying to construct a program which reads my email and stores them into a database using sql server. 我一直在寻找一种不使用该API的方法,因为我试图构建一个程序来读取我的电子邮件并将其存储到使用sql server的数据库中。 is there a way? 有办法吗?

You can use Socket classes. 您可以使用Socket类。 Send message directly. 直接发送消息。

Why not use JavaMail? 为什么不使用JavaMail? There are other libraries available, such as ChilKat's - or you could talk POP3/IMAP directly, you know open a socket on port 110/143 and issue commands and read the responses (which is what the libraries will do for you). 还有其他可用的库,例如ChilKat的库,或者您可以直接谈论POP3 / IMAP,您知道在端口110/143上打开套接字并发出命令并读取响应(这就是库将为您执行的操作)。

If you have to provide a single JAR file, you can merge the JavaMail classes (and dependencies) with your own code, or - depending on your target infrastructure - a WAR or EAR might be more appropriate. 如果您必须提供一个JAR文件,则可以将JavaMail类(和依赖项)与自己的代码合并,或者-根据目标基础结构-WAR或EAR可能更合适。

Cheers, 干杯,

If you want to do this the hard way, you can write eg a POP3 client in Java yourself. 如果您想用困难的方式做到这一点,则可以自己用Java编写例如POP3客户端。 Use Socket, connect to the right host and port (port is usually 110) and start issuing POP3 commands. 使用套接字,连接到正确的主机和端口(端口通常为110),然后开始发出POP3命令。

http://www.ietf.org/rfc/rfc1939.txt http://www.ietf.org/rfc/rfc1939.txt

http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM