Solved

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

Posted on 2004-03-30
7
386 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This is about my first experience with programming Arduino.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

752 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