Ubuntu – How to setup system email to send to a Gmail account

emailmail

Often when I'm working on a terminal, I'll see the "you have new mail in…" message. I know I can see this mail by looking in my system's mail folder (/var/mail/), but this is inconvenient. Also, if the message is important, such as a notice about low system resources, or drive problems, or a failed cron job, I may not see that message or check the system's mail folder for weeks or more.

How can I set it up so that all these messages get sent to a real email service, like Gmail, which I check daily?

Best Answer

See this:

Users can control their own mail delivery by specifying destinations in a file called .forward in their home directories.

So, when you do this:

echo "yourmail@example.com" > ~/.forward

the mails should be forwarded to the e-mail you've specified (in this case, yourmail@example.com)