- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: saving mail body
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2001 12:27 AM
тАО12-05-2001 12:27 AM
saving mail body
I want to automate a process of saving the body of a mail in a file whenever a new mail comes in and then delete the mail from a script.
Can you guys share some ideas?
Tia,
Sudip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2001 12:52 AM
тАО12-05-2001 12:52 AM
Re: saving mail body
You can edit the /etc/mail/aliases and put something like this:
some_aliases:"|cat - | mailx -s "hola" justo"
This send all the mails received by user some_aliases to other user by mail.
If you put:
some_aliases:"|cat - | scripttocut"
you can do the operation that you want. you only have to develop your scripttocut.
PD: you must run the newaliases command in order to made the changes efective.
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2001 01:21 AM
тАО12-05-2001 01:21 AM
Re: saving mail body
Have you tried using elm filters? With the ~/.forward, you can direct your inbound email as STDIN into your script.
"|/usr/local/bin/filter"
The elm filter guide can be found at
http://www.math.fu-berlin.de/~guckes/elm/guides/filter
The filter rules reside in $HOME/.elm/filter-rules eg.
$HOME/.elm/filter-rules:
===========================
# $HOME/.elm/filter-rules
#
# Filter rules for the Elm Filter program. Don't change without some
# serious thought. (remember - order counts)
#
# (for Dave Taylor)
# rule 1
if (from contains "!uucp") then delete
# rule 2
to "postmaster" ? save "/tmp/postmaster-mail.%d"
# rule 3
if (to "culture" and lines > 20) ? save "~/Mail/culture"
# rule 4
subject = "filter test" ? forward "hpldat!test"
# rule 5
if [ subject = "elm" ] savecopy "~/Mail/elm-incoming"
# rule 6
subject = "display-to-console" ? execute "cat - > /dev/console"
===========================
Hope this helps. Regards.
Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2001 01:57 AM
тАО12-05-2001 01:57 AM
Re: saving mail body
Get and install procmail. You can get it from:
http://hpux.tn.tudelft.nl/hppd/hpux/Networking/Mail/procmail-3.21/
Then, if you want to save every email body to a different file, add this to your .procmailrc file (in your home directory):
:0 b
*
folder/.
To save all email bodies to a single file (appended), add this to the .procmailrc file:
:0 b
*
file
I tested this and it works.
E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2001 06:23 PM
тАО12-05-2001 06:23 PM
Re: saving mail body
I have installed procmail and put this .procmailrc
PATH=/bin:/usr/bin:/opt/procmail/bin
HOME=/home/c727588
MAILDIR=$HOME/Mail #you'd better make sure it exists
DEFAULT=$MAILDIR/mbox #completely optional
LOGFILE=$MAILDIR/from #recommended
:0 b
*
/home/c727588/config/.
I have put the .forward file as follows
"|exec /opt/procmail/bin/procmail"
I am getting the following error message
$ /home/c727588/.forward: line 1: "|/opt/procmail/bin/procmail"... Addres
s c727588@nuh011.telecom.com.au is unsafe for mailing to programs
/home/c727588/.forward: line 1: "|exec /opt/procmail/bin/procmail"... Address c727588
is unsafe for mailing to programs
Can you help out?
Thanks,
Sudip