Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I there a way to trigger Java code execution when an email is recieved?

Posted on 2004-03-30
7
Medium Priority
?
396 Views
Last Modified: 2013-11-24
I found some links about connecting to mail servers and retrieving messages.  However, it would be really nice to automate it, so that code is executed when an email is recieved.  Is it possible, and if so - how?  

Thank you.
0
Comment
Question by:AlexRS78
  • 3
  • 3
7 Comments
 
LVL 11

Expert Comment

by:lbertacco
ID: 10721127
What platform? In unix the standard solution is to use procmail
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 10723180
>> What platform?

Doesn't matter because he is using Java: >> I there a way to trigger Java code execution when an email is recieved?

You can use the Java Mail API.
0
 

Author Comment

by:AlexRS78
ID: 10723490
I've checked the Java mail API - could not find anything that would do that.  There are ways to retrieve messages and such, but nothing that would trigger stuff on email reciept.  It is all connect-do stuff-disconnect....  

Since we're talking about the mail server triggering the code execution, I would think that it is important which platform/mail server is used though...  We're at the design stage at this point, just looking at some options.  They could go with MS Exchange or Unix-based mail servers, not sure yet.  
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 11

Expert Comment

by:lbertacco
ID: 10723576
That's why I asked for the platform.
Only your MDA (mail delivery agent) can trigger the execution of your code upon message arrival. Under unix the most common MDA is procmail.
If you don't have any MDA (normal when mail is not stored locally), then your only solution is to periodically poll the mail server and see if new messages have arrived.
0
 

Author Comment

by:AlexRS78
ID: 10723648
Can you please explain procmail a little further?  Is it a mail server app, or just an add-in sort of thing?  I am mostly MS, so I'm kind of lost here.  I'll most likely need to explain people how this would work though.

Thanks!  
0
 
LVL 11

Accepted Solution

by:
lbertacco earned 2000 total points
ID: 10723841
The MDA is the process that dispatch mails to users on systems with a mail server.
In a unix machine with an MTA running (MTA is mail transfer agent, the most common of which are sendmail, postfix, exchange) running, the MTA receives the mail, then pass it to and MDA (procmail) which in turn puts it in the user mailboxe.
Anyway this is what happens on machines that are mail servers (which can be translated in : having an SMTP server receiving mail).
It's much more common to have emails kept on some remote host and just use an email client to retrive that via POP or IMAP. In this case there is no other way than periodically poll the remote system to see if new email have arrived.
Of course, if you can configure the remote system at your pleasure, you can configure it to run a small local program upon email arrival and make this small program simply notify your machine that there is new mail.
0
 

Author Comment

by:AlexRS78
ID: 10723859
Thanks a lot!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question