My cron jobs sometimes sends mail to /var/mail/USERNAME. I normally read it by log on the Mac computer and run mail
command to read and delete these mails. But how to deliver/forward such mails to my Gmail automatically? I would like to read such mails from different Mac computers in one Gmail account.
How to automatically deliver /var/mail/USER to the Gmail
cronemailgmail
Best Answer
On my High Sierra (10.13.4) machine, mail honors the .forward file. Create a file in your home directory called ".forward" containing an email address. All your mail on the Mac system will be forwarded to this address.
It makes good sense to limit access to this file, with chmod.
For example (open Terminal in your home directory):
Then you can test by sending a mail to yourself, from the command line:
Note: this only works for forwarding MacOS system mail, not for forwarding from any of your cloud mail services. You can enter any valid e-mail address in the file.