Sendmail----concept of incoming mails

  i know sth about how mails be sent to the destination
mail server,but i know little about how things work after
mails arrive the server (i know all mails will be stored
under /var/spool/mail,categeried by different user account),but i got two troubles:
  1th is: if i use "mail" on the shell to read the mail,it
seems that the mail system will make a "readed" signal to
this letter,thus,i could not download it by some MUA(such as OUTLOOK EXPRESS),i want to know how to "UNDO" the signal to "NOT-READED"?
  2nd is: if i use some MUA that now download all letters
of my account,just see them on the server (such like:erdu
os software),the mail system will put all letters in /var
/spool/mail/USERNAME to /home/USERNAME/mbox,so i could not
use "mail" or "elm" on the shell to see it,although i copy
"mbox" to /var/spool/mail as the USERNAME,i still can NOT
manage them by "mail" or "elm"-----that's the same problem
like my first question
   besides answer these two questions,if you can introduce
me the knowledeges about "is there any STATUS of incoming
letters & how to see and change the STATUS",i will double
the award point.
   thank you
Who is Participating?

The status is recorded in the header of each message.

In that file /var/spool/mail/username, all messages are in that file one after the other.  Each message has a header including many things such as From: To: Date: Subject: ...etc and one of those is Status:

For new messages you would find the line as

Status: O

and after you read a message it changes to

Status: RO

so you only need to take out the R from the status to make it look like it is still new.

Good Luck,

Tarik Daoud
wingboadAuthor Commented:
sorry,i type sth wrong in my question:
 "2nd is: if i use some MUA that now download all letters
of my account", the "now" should be changed as "NOT"
wingboadAuthor Commented:
oh,thank you,tdaoud:
   it's really a good news that i can change the status,but
i still have one problem: if i have hundreds of mail to cha
nge the STATUS flag,obviously,by manual is not a good idea,
so whether could you tell me is there any software or solu
tion to deal with this
   (BTW,would you also see my "2nd" question of my first
question,related with the "mbox" problem) thanks a lot
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

If your MUAs are getting your mail via POP they most likely are setup to delete the originals on the server and therefore the emails are no longer available when use a "local" agent (and vis versa). Most POP MUAs can be configured to leave the emails on the server after they have downloaded them.

Hope I understood your question
If you really need to be able to read email from multiple places and always need to be able to see all messages that haven't been deleted then you need to switch to using only IMAP clients to access email. The IMAP system is a server based remote email access system and messages that haven't been deleted or moved to a local folder on the client running the MUA will remain in your INBOX. That allows them to be seen by any other IMAP MUA run on any other client. Suitable Linux clients include Netscape, pine, and others. On a windows box Netscape, Outlook, Eudora, etc. come readily to mind.
wingboadAuthor Commented:
oh,my friends:
   i know POP3 & IMAP,but the trouble bothered me is that i
want to see and MANAGE all mails on the server,before they
are downloaded to the clients.
   my 1st question is related with the STATUS problem of le
tters,tdaoud have given a good answer. but i wonder if i ne
ed to change lots of mails' STATUS,is there any tools or sh
ell command can do that.
   and my 2nd question is about using Eudora,if i use this
software,it will put all mails to /home/USERNAME/mbox,i don
't know what's the difference about mbox and /var/spool/mai
l/USERNAME,i want to know more about HOW incoming letters s
tore on the mail server,i will doulbe my point for this rea
   Waiting for your smart answer,thanks
Ahh, the problem isn't with your INBOX, but rather that you want to look at INBOX's other than your own without affecting the status of those INBOX's.

This pretty much implies that you need to use something that isn't an ordinary mail client to examine your user's INBOX's. The normal mail client is either going to change the status of messages it has seen or it is going move the mail from /var/spool/mail/some-user to your home directory.
I suppose you could modify each of the messages in each user's inbox to change the status back to unread, but I know of no existing tool designed for that purpose.

If all you want to do is to look at what messages are in a user's INBOX and don't need to see into the attachments or delete messages, you can use "more" to look at the file, e.g., "more /var/spool/mail/some-user". It's kind of a pain to examine big INBOX's that way and you can't look at what's in an attachment, but it won't change status of the messages. Also if this activity is just for monitoring there are other ways that it can be done. It is possible to set up sendmail so that it logs, in normal mbox format, all messages that reach the server. This includes messages that arrive from Internet hosts and messages that your user's send through the SMTP server. That has the advantage of collecting all of the traffic into one place where it can be easily examined by a normal mail client.

So in summary, as to (1) I don't know of a tool that already exists to change the status of messages. One could be written, but you have to be careful that two things don't try to change the status of a message at once. Normally the POP or IMAP server handles all of that and it can ensure that a chnge in status is done safely.

As to (2), the messages are initially place in /var/spool/mail/some-user in what is commonly referred to as mbox format. The mbox format, in this case, is a simple file format where each message starts with a Unix "From" line and is separated from the preceeding message by a blank line. Note that different email implementations use other methods of managing the user INBOX's (Cyrus IMAP uses a directory per user and each message is a separate file). Different mail clients handle the INBOX in different ways. Some clients move all mail from /var/spool/mail/some-user to the user's home dir and store it there in a variety of formats.
wingboadAuthor Commented:
oh,what a pitty that no good tools can help me,(i've tried
to use "more" to check big incoming letter files,it really
made me crazy~~~~)
  although i don't get what i want,but i will still do wha
t i promised before,thank Ilevie for such detailed introdu
ce,and also thanks a lot to Tdaoud,a quite good solution g
  in fact,i should pay 50 point to tdaoud,and pay another
50 point to ilevie (because tdaoud answered my 1st question
and ilevie answered my 2nd question,this is my fault that
i really want to know more things ASAP,i will pay attenti
on next time.
  so,at last i decide to pay tdaoud my point,(because i t
hink ilevie have had much much more pointS,haha----a joke)
i really feel sorry to ilevie,say thanks again for your detailed answers.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.