jl66
asked on
How to dump/get mail list to a file on Linux
If I type mailx in console, it shows that
....
U 17 J1.smith@A.com Fri Mar 30 14:38 88/5740 "Re: Test1"
U 18 J2.king@B.com Fri Mar 30 16:50 56/3244 "Please read this one"
U 19 J2.king@B.com Mon Apr 9 11:03 236/11783 "Server Failure"
....
Is there any way to dump all the lines above to a file? I do not need the email body, but need all the lines.
Do any gurus shed some light on it?
....
U 17 J1.smith@A.com Fri Mar 30 14:38 88/5740 "Re: Test1"
U 18 J2.king@B.com Fri Mar 30 16:50 56/3244 "Please read this one"
U 19 J2.king@B.com Mon Apr 9 11:03 236/11783 "Server Failure"
....
Is there any way to dump all the lines above to a file? I do not need the email body, but need all the lines.
Do any gurus shed some light on it?
Did you read the above suggestion? Sorry, I've updated the comment, so you might not have received a message.
ASKER
Thanks for offering the tip. Unfortunately, it did not work on my system. Have you tried it?
Yes.
mailx -H
lists all the headers in my mailbox.
mailx -H
lists all the headers in my mailbox.
Well,
I'm running Unix (AIX).
In some other systems I found
mailx -P
working better than "mailx -H".
I'm running Unix (AIX).
In some other systems I found
mailx -P
working better than "mailx -H".
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
An equal question is that in mail box ie /var/spool/mail (a file), I expect it contains everything on mail. Which variable is for NEW emails and the emails that have been read?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the update.
Unfortunately in our system, there is no -H option.
I tried to get something in the following way:
1) tail -f /var/spool/mail #(mail box file).
2) send a mail to this linux server.
3) immediately a lot of messages shown on screen via tail -f.
The email software updates the file when any new email arrives. If I try mailx, it shows the mail I just sent >N ...., which is a new mail. I guess in the file /var/spool/mail there is some place to store this info ">N", or there is some other queue file to store it. How to find it?
Our system is redhat: 2.6.18-274.7.1.el5
Unfortunately in our system, there is no -H option.
I tried to get something in the following way:
1) tail -f /var/spool/mail #(mail box file).
2) send a mail to this linux server.
3) immediately a lot of messages shown on screen via tail -f.
The email software updates the file when any new email arrives. If I try mailx, it shows the mail I just sent >N ...., which is a new mail. I guess in the file /var/spool/mail there is some place to store this info ">N", or there is some other queue file to store it. How to find it?
Our system is redhat: 2.6.18-274.7.1.el5
All files in the mailbox are "new", usually,
Files which are not "new" go to ~/mbox, as I already wrote above.
Files which are not "new" go to ~/mbox, as I already wrote above.
ASKER
Very helpful. Close to what I wanted.
mailx -H > outputfile