Solved

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

Posted on 2004-03-30
7
374 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:mayankeagle
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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 500 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now