Assembling a Message from System.in (Standard Input)

  • Thread starter Rogue Chameleon
  • Start date
R

Rogue Chameleon

Hi all

I am planning on using the etc/aliases to pipe an email message to a java
program.

The java program will receive the email message via "System.in". I want to
be able to take this input stream and create a Mail Message out of it, and
then pull the attachment from the message.

Does anyone have experience doing this?
 
T

Thomas Weidenfeller

Rogue said:
Does anyone have experience doing this?

There are read-to-use tools out there for your purpose. A rather old one
is e.g. metamail. There might be better ones.

If you want to do it yourself, you should take into account the
startup-time of the VM. It might be impractical to get the VM up each
time a new message comes in. Therefor, another language, or a
permanently running java application which is feed via a named pipe
might be a better idea.

If I would have to decide, I would not program anything, but use an
existing tool like metamail. If this is not possible, I would use on of
the classic Unix scripting languages, and not a full fledged programming
language, and not Java.

/Thomas
 
G

Gary M

Rogue said:
Hi all

I am planning on using the etc/aliases to pipe an email message to a java
program.

The java program will receive the email message via "System.in". I want to
be able to take this input stream and create a Mail Message out of it, and
then pull the attachment from the message.

Does anyone have experience doing this?

Using javamail, you can construct a MimeMessage from an InputStream.
Should be a piece of cake if your stream is formatted as per RFC821.

Gary
 
R

Rogue Chameleon

Thomas Weidenfeller said:
If I would have to decide, I would not program anything, but use an
existing tool like metamail. If this is not possible, I would use on of
the classic Unix scripting languages, and not a full fledged programming
language, and not Java.

/Thomas

I've been told that using perl might be a better solution.... thoughts?
 
T

Thomas Weidenfeller

Rogue said:
I've been told that using perl might be a better solution.... thoughts?

Perl would be my third choice (still a good one) for this task.

First would be: An existing tool (I pointed you to one)
Second would be: Some classic Unix scripting (old habits never die :)
Third would be: Some Perl scripting

Then somewhere after this: C (if you need a programming language)
And after this: Java

Java is simply not the best choice for this kind of system programming
and text processing.

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top