gpt4 book ai didi

java - 如何监听多个 Gmail 帐户上传入的电子邮件 - Java

转载 作者:行者123 更新时间:2023-12-02 11:48:56 24 4
gpt4 key购买 nike

我想建立一个系统,可以在 JAVA 中监听 5 个不同 gmail 帐户上的新电子邮件。我阅读了 javax.mail 文档,发现 javax.mail.session 是一个静态类,我无法使用它连接到多个电子邮件。有什么方法可以实现我想要用 Java 或任何其他语言实现的目标吗?

最佳答案

I found that the javax.mail.session is a static class

不,你没有,也不,它也不是。

and I cannot connect to more than one email using it

没有。您可以使用单个 session :如下面@billshannon所述(在评论清理的情况下重复):

You don't need multiple Sessions, but you might find it useful if you need significantly different configuration for different servers. But since you're only connecting to Gmail, that shouldn't be an issue. Each Store can connect with different credentials by calling the appropriate connect() method.

关于java - 如何监听多个 Gmail 帐户上传入的电子邮件 - Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48014919/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com