Ubuntu mail command – where does it store sent mail?

I am very new to Ubuntu and have an issue where sent mail from our Ubuntu Server has been failing for a number of weeks. We are using the mail command (invoked from PHP) like so:

mail("mygroup@ourGmailDomain", "Subject", "Message", "Header");

I can see from the file /var/log/mail.log the e-mail being attempted to send and it is failing to deliver. Does the “mail” tool store a copy of what it has sent somewhere?

There has probably been no configuration of the mail settings. This is not a tool I am at all familiar with, so any pointers into how to find sent mail, or even turn it on so all attempts at sending are now stored, is very much appreciated.

Update with my findings:

I believe that the sent e-mails were never stored, so I’ve lost 2 weeks worth of e-mails from my users. So I need to modify my setup to automatically store e-mails.

Answer

The local mail directory by default is /var/mail/
If the mail is designated to the local user like root@localhost, it will go to /var/mail/root

Attribution
Source : Link , Question Author : Phil , Answer Author : Peycho Dimitrov

Leave a Comment