Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get a mail as a file on Linux

Posted on 2013-05-28
5
Medium Priority
?
451 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:Brian Utterback
ID: 39204416
Are the mails on a server or local on the file system?
0
 

Author Comment

by:jl66
ID: 39204548
local.
0
 
LVL 21

Accepted Solution

by:
Daniel McAllister earned 1600 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 400 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
To show how to generate a certificate request 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 >> Certificates…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
Suggested Courses

916 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