LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to view mail sent to root@localhost in Ubuntu Precise? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-view-mail-sent-to-root%40localhost-in-ubuntu-precise-4175509211/)

judoka 06-26-2014 12:14 AM

How to view mail sent to root@localhost in Ubuntu Precise?
 
I'm running Ubuntu Precise (12.04) and /etc/mail is not listed as a directory, but there is a /etc/alternatives/mail folder that is empty. The problem is that I installed a couple of programs that send logs to root@localhost and I want to be able to view it. I installed mailutils with apt-get but still no luck. Do I need to set-up Postfix in order to view mail sent to root@localhost? And if not then what should I do?

kilgoretrout 06-26-2014 12:39 AM

Mail is usually stored at /var/mail/<username>. If mail is being delivered to root, you should see a file named "root" in /var/mail. To read it install "mutt"($ sudo apt-get install mutt). To read root's mail, open a console and run:

$ sudo mutt

If that doesn't work and assuming there is a /var/mail/root, file, then try:

$ sudo mutt -f /var/mail/root

EDDY1 06-26-2014 12:58 AM

Quote:

Originally Posted by kilgoretrout (Post 5194156)
Mail is usually stored at /var/mail/<username>. If mail is being delivered to root, you should see a file named "root" in /var/mail. To read it install "mutt"($ sudo apt-get install mutt). To read root's mail, open a console and run:

$ sudo mutt

If that doesn't work and assuming there is a /var/mail/root, file, then try:

$ sudo mutt -f /var/mail/root

Code:

Should be able to just
cd /var/mail/root
ls
sudo cat /var/mail/root/<message>


judoka 06-26-2014 01:50 AM

Thanks kilgoretrout mutt is a very interesting little program I set up mails for the two user accounts on my system in the /var/mail/ directory but when I try to send mail I get an error. To send mail I do:
Code:

mutt -s "Welcome Msg" willz@localhost < email_body.txt
but I get this error:
Code:

sendmail: fatal: open /etc/postfix/main.cf: No such file or directory
Error sending message, child exited 75 (Deferred.).
Could not send the message.

Does that mean that I cannot send or receive messages unless I install postfix?

kilgoretrout 06-26-2014 10:20 AM

You need to have some MTA(message or mail transfer agent) installed to send email. The two most common are Postfix and Sendmail. If you install Postfix and just go with the defaults you should be able to send email.

judoka 06-26-2014 12:24 PM

Thanks kilgoretrout, appreciate your help.


All times are GMT -5. The time now is 05:03 PM.