春季如何最好在基于Java的系统中接收电子邮件? [英] How can receive emails in Java based system preferably with spring?

查看:150
本文介绍了春季如何最好在基于Java的系统中接收电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查阅了Google和Spring文档,但收不到电子邮件.

I have looked up Google and Spring documentation but can not find any thing on receiving emails.

我需要构建一个可以接收来自POP3和IMAP的电子邮件的客户端(有点不完整的客户端).我已经在项目中使用Spring,因此偏好设置为Spring.

I need to build a client (kind of not fully blown client) that can receive emails from POP3 and IMAP. I am already using Spring in the project so preference is Spring.

很多链接都指向James,尽管看起来确实不错,但是它并不能提供足够的文档,我什至不能确定它能完成我想做的事,即只是一个能够接收电子邮件的小客户.

Lots of links point to James but while it does look like a good project does not provide enough documentation and I am not even sure it does what I am after i.e just a small client that is able to to receive emails.

推荐答案

电子邮件接收适配器.这是文档中的IMAP示例:

Spring integration was designed to solve these kind of problems. In particular it has e-mail receiving adapters. Here is an IMAP example from the documentation:

<mail:inbound-channel-adapter id="imapAdapter"
      store-uri="imaps://[username]:[password]@imap.gmail.com/INBOX"
      java-mail-properties="javaMailProperties"
      channel="recieveChannel"
      should-delete-messages="true"
      should-mark-messages-as-read="true"
      auto-startup="true">
      <int:poller max-messages-per-poll="1" fixed-rate="5000"/>
</mail:inbound-channel-adapter>

这篇关于春季如何最好在基于Java的系统中接收电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆