1832964 Members
2391 Online
110048 Solutions
New Discussion

Re: mailx within script

 
TSYO
Occasional Advisor

mailx within script

hello,

I want to do script in which a user reads his mail and later he erases it. I have seen that tools exist to reformat a mail type MIME (reformime, reformail), but do not see how I can do it in HP-UX.
Do You know some way to manage the mailbox of a user without doing it interactively? The commando mailx can be executed in a shellscript?
6 REPLIES 6
Mel Burslan
Honored Contributor

Re: mailx within script

I am not quite clear what you want to do here. Can you elaborate a bit more may be ? Do you want to write a script which will imitate like the user is reading his/her mail using mailx and delete them ? Or is it just going to be a wrapper around the mailx utility, giving a different user interface to the user ?
________________________________
UNIX because I majored in cryptology...
TSYO
Occasional Advisor

Re: mailx within script

I want to have a process always running. This process must be waiting for the new post office. When it arrives one, it reads the mailbox, it processes the mail and it will erase it of the mailbox.
The process and mbox belong to the same user.
Mark Grant
Honored Contributor

Re: mailx within script

Scripting this isn't too much of a problem. perl particularly has various modules for reading mailboxes but if you use standard unix mailboxes even a humble shell script can do it as mail is stored and just one big text file.

However, I feel maybe you need to have a look at "procmail". It isn't a great web page but you can have a look here.

http://www.procmail.org/
Never preceed any demonstration with anything more predictive than "watch this"
Mel Burslan
Honored Contributor

Re: mailx within script

procmail was the suggestion that I had on my mind. I just wanted to make sure that I understood your purpose. Yes, it is a great utility to sift through ungodly amounts of mail and categorize them. hope this helps you, otherwise let us know what exactly your needs are so a better suggestion can be made.
________________________________
UNIX because I majored in cryptology...
TSYO
Occasional Advisor

Re: mailx within script

I cannot install products in this server, so I must find another alternative...
TSYO
Occasional Advisor

Re: mailx within script

I have been able to solve calling it to mailx with a EOF. Thank you very much by your contributions.