gpt4 book ai didi

java - 无法使用 JavaMail API 连接到 Protonmail

转载 作者:行者123 更新时间:2023-11-30 06:13:44 24 4
gpt4 key购买 nike

我编写了一个小型 Java 程序来发送邮件。当我尝试从 gmail 发送邮件而不是从 protonmail 发送邮件时,它可以工作。这是代码:

这是日志:

DEBUG: JavaMail version 1.4.7
DEBUG: URL jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/gimap.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/gimap.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/imap.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/imap.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/pop3.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/pop3.jar!/META-INF/javamail.providers
DEBUG: URL jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/smtp.jar!/META-INF/javamail.providers
DEBUG: successfully loaded resource: jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/smtp.jar!/META-INF/javamail.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.gimap.GmailSSLStore=javax.mail.Provider[STORE,gimaps,com.sun.mail.gimap.GmailSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.gimap.GmailStore=javax.mail.Provider[STORE,gimap,com.sun.mail.gimap.GmailStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], gimap=javax.mail.Provider[STORE,gimap,com.sun.mail.gimap.GmailStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], gimaps=javax.mail.Provider[STORE,gimaps,com.sun.mail.gimap.GmailSSLStore,Oracle]}
DEBUG: URL jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/smtp.jar!/META-INF/javamail.address.map
DEBUG: successfully loaded resource: jar:file:/D:/Programmation/Java/Libraries/javamail-1.4.7/lib/smtp.jar!/META-INF/javamail.address.map
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "mail.protonmail.ch", port 587, isSSL false
421 Cannot connect to SMTP server ::ffff:185.70.40.101 (::ffff:185.70.40.101:587), connect error 10060
javax.mail.MessagingException: Could not connect to SMTP host: mail.protonmail.ch, port: 587, response: 421
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1949)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at MailSender.send(MailSender.java:50)
at Start.main(Start.java:6)
DEBUG SMTP: could not connect to host "mail.protonmail.ch", port: 587, response: 421

最佳答案

您无法连接到 mail.protonmail.ch:587,因为该服务不存在。没有任何文档表明此特定 SMTP 服务器存在。您收到的连接错误 10060(连接超时)进一步证明了这一点。

如果您想使用 Protonmail,则需要使用 ProtonMail Bridge 。然后,这将在本地主机上生成一个服务器套接字,然后您可以连接到该套接字。请参阅:Setup Guide

您可以从这里下载 Bridge:https://protonmail.com/bridge/

关于java - 无法使用 JavaMail API 连接到 Protonmail,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49679066/

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