Solved

Get a mail as a file on Linux

Posted on 2013-05-28
5
447 Views
Last Modified: 2013-05-29
Would like to check certain mails daily with Shell script on Linux env. One way is to dump one mail satisfying certain conditions into a file and process it with shell commands, and then loop each mail. How to do that? Any gurus shed some light on it?
Thanks in advance.
0
Comment
Question by:jl66
5 Comments
 
LVL 22

Expert Comment

by:blu
ID: 39204416
Are the mails on a server or local on the file system?
0
 

Author Comment

by:jl66
ID: 39204548
local.
0
 
LVL 20

Accepted Solution

by:
Daniel McAllister earned 400 total points
ID: 39204583
Your solution is dependent upon the mail server software you use. Specifically, the way the mail software stores messages.

In general *nix systems store mail messages in 1 of 2 ways:
 mbox -- essentially one giant file with all mail message contents in that one file. Each Inbox or other "folder" is a separate file.
 maildir -- a directory heirarchy, so your folders are folders, and each message is an individual file. Message status is usually managed by manipulating the filename.

So, to begin to answer your question appropriately, we'll need to start with what mailbox type your server uses!

Dan
IT4SOHO
0
 
LVL 23

Assisted Solution

by:nemws1
nemws1 earned 100 total points
ID: 39204920
Have you used or heard of procmail?  You can set up a .forward file with procmail and based on rules either have an e-mail sent to your inbox or have it processed through a shell script.

This is even covered (briefly) in the procmail FAQ:
http://partmaps.org/era/procmail/mini-faq.html#rtfm
0
 

Author Closing Comment

by:jl66
ID: 39205310
Thanks for the tips. I figured out the way to do the script.
0

Featured Post

Independent Software Vendors: 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

Utilizing an array to gracefully append to a list of EmailAddresses
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

679 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