此异常是我在使用Spring集成连接imap gmail存储时遇到的。请看一下代码{@自动连线私有IntegrationFlowContext flowContext;
public void startMail(String user, String pw) {
IntegrationFlow flow = IntegrationFlows
.from(Mail.imapIdleAdapter(imapUrl(user, pw))
.javaMailProperties(p -> p.put("mail.debug", "true"))
//.userFlag("testSIUserFlag") // needed by the SI test server - not needed if server supports /SEEN
.headerMapper(new DefaultMailHeaderMapper()))
.handle(System.out::println)
.get();
this.flowContext.registration(flow).register();
}}
其中imapUrl(user,pw)返回网址为imap://[email protected]:[email protected]:993 / INBOX
请帮助我摆脱这个例外。
注意:我读了一篇文章here,说需要在凭据中转义'@'。作为Java Spring Boot的新手,请让我知道我如何转义'@'
默认情况下,GMail不支持JavaMail客户端;您必须启用“安全性较低的客户端”(或类似功能)。
使用%40
替换@
。