Reading email from Linux

JamesBowen

19+ years progress programming and still learning.
Hi all.

This is going to be an easy one.

Currently we send emails out to our customers and in the subject line I have include there customer ID and a email sequence number in the subject line.

Is there a method of automatically reading the email responses (parsing the subject line) from Linux and import the content/body (may be any attachments)of the email into the Progress DB?

Many Thanks

-- James.
 
Try the mailx command.

Test it at the command prompt by:
echo Hello | mailx -s "Test1" youremailaddress
echo Hello2 | mailx -s "Test2" youremailaddress

Then view all email headers using "mailx -n" but send an "x" to it to kick it out of its interactive state.

echo x |mailx -n

This is the sample output on our linux box:

Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/linux": 2 messages 2 new
>N 1 youremailadress@... Thu Sep 27 07:59 16/676 "test"
N 2 youremailaddress@... Thu Sep 27 08:12 16/682 "Test2"
[linux]$

So, in progress, you'd do something like this:

def var inputline as char no-undo.
input through value ("echo x |mailx -n").
repeat:
inputline = "".
import unformatted inputline.

end.
input close.

To read the messages by message number, try:
echo 1 |mailx
to read message 1 and
echo n |mailx
to read message n.

If you want to read the messages that have been read before, you need to access the mailbox mbox.

echo x |mailx -f mbox -n

echo 1 |mailx -f mbox

As for attachments, I don't know whether mailx can read attachments. I can't find any information on how to do this. It might be worth forwarding the mail to another email account and using Outlook to read the attachments.

Hope this helps.
 
Back
Top