Solved

Get a mail as a file on Linux

Posted on 2013-05-28
5
444 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weird Samba Connectivity Issue... 7 40
email not reaching a mydomain.com from partner.com 3 17
Email password question 6 41
Coding C# in Linux 8 66
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

772 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