我正在开发一个 java 邮件客户端:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class MailClient {
public static void main(String[] args) {
try {
Properties props = new Properties();
Session session;
URLName url = new URLName("pop3","pop.gmail.com",995,"","email@gmail.com","password");
session = Session.getInstance(props, null);
Store store = new POP3SSLStore(session,url);
store.connect();
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
Message message[] = folder.getMessages();
for (int i=0, n = message.length; i<n; i++) {
System.out.println(message[i].getSubject());
}
folder.close(false);
store.close();
}
catch (MessagingException e) {
System.out.println("Error: " + e);
}
}
}
发生的错误是这样的:
MailClient.java:13: error: cannot find symbol
Store store = new POP3SSLStore(session,url);
symbol: class POP3SSLStore
location: class MailClient
1 error