Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-03-30
7
Medium Priority
?
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

719 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