Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Sendmail----concept of incoming mails

Posted on 2001-06-24
Medium Priority
Last Modified: 2010-05-18
  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
Question by:wingboad

Author Comment

ID: 6223266
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"

Accepted Solution

tdaoud earned 300 total points
ID: 6223560

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

Author Comment

ID: 6225981
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

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Expert Comment

ID: 6226033
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
LVL 40

Expert Comment

ID: 6226259
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.

Author Comment

ID: 6229719
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
LVL 40

Expert Comment

ID: 6232597
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.

Author Comment

ID: 6233592
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.

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

578 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