Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-10-2011, 10:25 AM   #1
Registered: Mar 2010
Location: INDIA (chennai)
Distribution: centos
Posts: 271
Blog Entries: 7

Rep: Reputation: 18
extracting a particular mail

hi all,

I just want to know is it possible to extract a single mail from the mail path i.e. /var/mail/root.

for ex. i am having this mail in /var/mail/root.

From root@localhost.localdomain Thu Mar 10 21:47:47 2011
Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (localhost.localdomain [])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id p2AGHlx4004190
for <root@localhost.localdomain>; Thu, 10 Mar 2011 21:47:47 +0530
Received: (from root@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id p2AGHlD5004189
for root@localhost.localdomain; Thu, 10 Mar 2011 21:47:47 +0530
Date: Thu, 10 Mar 2011 21:47:47 +0530
From: root <root@localhost.localdomain>
Message-Id: <201103101617.p2AGHlD5004189@localhost.localdomain>
To: root@localhost.localdomain
Subject: new

company test
requirement newinstance


how to extract only this mail from /var/mail/root

can we do that with the help of date and time for that particular email.

if possible whats the code your suggestions please.

Your suggestions please.


Last edited by dinakumar12; 03-10-2011 at 10:28 AM.
Old 03-10-2011, 11:15 AM   #2
LQ Guru
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
You could probably use sed and cut for something like that, using date and time like you said.
Old 03-10-2011, 11:57 PM   #3
Registered: Mar 2010
Location: INDIA (chennai)
Distribution: centos
Posts: 271
Blog Entries: 7

Original Poster
Rep: Reputation: 18

yes,but can i get the exact code for that, i am also searching for this, mean while if any one got the code kindly post it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SOLUTION for extracting pdf from e-mail Demerzel Programming 3 08-09-2010 12:31 PM
E-Mail Read Receipt E-Mail Delivery Status E-Mail tracking number. ytd Linux - Software 3 02-14-2009 04:02 AM
can mail command be used to send mail onto global mail servers like yahoo etc dale_chip Linux - Newbie 4 08-12-2008 08:33 AM
with the linux proxi, backend pop3 mail client can not receive mail and send mail rubin823 Linux - Networking 0 12-21-2006 10:06 PM
Extracting mail attachment filename Jinkzer Linux - Software 3 02-28-2004 08:07 AM

All times are GMT -5. The time now is 07:38 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration