Solved

Get a mail as a file on Linux

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

860 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