I have looked up Google and Spring documentation but can not find any thing on receiving emails.
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.
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.
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>
POP3 and IMAP are not protocols that receive email. They go out and fetch it from a server.
The official JavaMail API
provides a platform-independent and protocol-independent framework to build mail and messaging applications.
Take a look!
Related
I am new to spring.I had a doubt regarding sending mails.How can i send a bulk of mails from spring based web application in which i have a requirement in my project.
I have no idea on this please suggest me something which is helpful
Thanks in advance
you can send bulkemails using spring and it also offers scheduling a mails to multiple reciepts refer this example
refererence
You can also go through some of the real sites which are already exists and using for marketing with bulkmails check this
so that you can get an idea to work on your requirements
I usually offer some code but in this case I would just copy-paste from this tutorial.
Spring has very little in terms of mailing support (which is found in the context-support module), which itself is just a wrapper over the javax.mail package.
I would use a service like Amazon SES, which helps keep your email messages out of spam boxes.
Install an MTA (like Postfix) in Satellite Mode on your local machine. This will relay emails to Amazon SES.
Use JavaMail to send email messages to localhost, and they will go to your MTA queue, and get sent to Amazon.
Make sure you are complying with anti-spam legislation: http://www.business.ftc.gov/documents/bus61-can-spam-act-compliance-guide-business
I want to be able to send/receive mail from my Java Server application. Is there a standard tool chain to use? [The main thing is that I am writing an enterprise web app in Java, and I need a way to (1) send emails that contain authorization codes and (2) receive complaints.]
Thanks!
EDIT: I apologize. This is entirely my fault. I was not clear in the spec.
When I say send/receive emails, I meant: I need my application to be able to run it's own mail server. I don't have an external imap/pop3 account I'm using. My application need to provide the mail server.
The Apache James project might be a good starting point. It is a full-featured SMTP server written in Java. I am certain it is possible to interface other Java applications with James and/or write James extensions.
what you're looking for it's java mail and it's compatible with EE here's the link
Sending and receiving EMails you can do with the help of Java EE standard JavaMail API. If your application is spring enabled, you can use org.springframework.mail package which has some good abstraction utilities. Apart from this you need to have MTA(Mail Trasport Agent) like James as mentioned above.
Definitely a good alternative is Java E-mail Server (JES) at http://javaemailserver.sourceforge.net/. It's a full blown server for sending and receiving mail. "JES is a multi-featured hybrid MTA/MDA server written in the java programming language."
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?
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");
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.
Hey. I currently want to develop a simple program in Java that sends out email. Not just a few emails, but actually a lot (10k+)
I have a subscribers list that all agree to it, by the way.
Anyway, I cannot send these emails via Gmail or anything like that - They do not allow that many emails to be sent. So the basic question is: How do I send emails by making the actual sending computer an email server?
I'm sure I should use some libraries, I heard about ChillKat or something like that.
Could anyone explain / help me out? Would be very much appreciated.
the library - commons-email, built ontop of the harder to use JavaMail
the servers
James - java based
Postfix - for unix/linux (howto)
many more - there are many smtp servers. Each requires some non-trivial configurations before you can use it in production. It is better to turn to an administrator for this.
James is a very powerful email server base on Java which with you can use the JavaMail API. Moreover James integrate the mailet API which is very usefull to improve the functionality of your mail server.
You can configure it to set the gateway on gmail easily changing the config file. (see this topic)
You can find a very good tuto here about James and mailet: Working with James
I've asked Google and searched through the NServiceBus website and forums, but I can't seem to find any prescriptive guidance on how I would write a Java application to subscribe to a publisher. Does anyone have any such link or experience?
This scenario is not well supported out of the box - you'll need to do some infrastructure munging yourself. In general, look at how the proxy is built, and add some gateway-style HTTP communication in the mix, or expose that with a standard .NET webservice.
You could manually send the subscribe message to the publisher over MSMQ, the publisher would then send any relevant messages to your java subscribers input queue. But you would need to receive those manually also.
I guess you're then committed to using MSMQ as your transport layer for your entire bus also.