Reading mails using Spring email abstraction layer

孤街浪徒 提交于 2020-01-01 05:36:29

问题


Spring provides abstraction over JavaMail Api.

There are lot of examples to describe how to send mail using spring email abstraction layer.

but how can i read emails using this?


回答1:


Maybe because Spring does not have a built-in support for receiving e-mails?

http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mail.html:

24. Email

24.1 Introduction

The Spring Framework provides a helpful utility library for sending email that shields the user from the specifics of the underlying mailing system and is responsible for low level resource handling on behalf of the client.

If you want to receive e-mails you must use some external libraries, including Spring Integration with POP3 support.




回答2:


You can configure Spring to poll for emails from a POP or IMAP server

http://docs.spring.io/spring-integration/reference/html/mail.html

Or access directly.

MailReceiver receiver = new Pop3MailReceiver("pop3://usr:pwd@localhost/INBOX");


来源:https://stackoverflow.com/questions/7792458/reading-mails-using-spring-email-abstraction-layer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!