8

I have a system job that fails and sensd me mail that I can read with the mail command. That means I still need to login to the mail server to get the emails and read them. The server supports sending mail to external clients, such as gmail. How can I set mail to automatically forward my mail to my gmail?

I am not the system administrator, and do not have root access on this system.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
j0h
  • 3,467
  • 8
  • 27
  • 36
  • [mail aliases](http://www.cyberciti.biz/tips/how-to-redirect-one-users-mail-to-another-user-with-postfix.html)? – Bratchley Aug 04 '16 at 15:59
  • loojks like a rootly power is needed so no, mail aliases arent an option – j0h Aug 04 '16 at 19:39

1 Answers1

9

You can create a .forward file in your home directory, and the mail will be forwarded.

cd 
echo "[email protected]" > .forward
chmod 644 .forward                 # change permission else it won't work
magor
  • 3,592
  • 2
  • 11
  • 27
  • .forward was to be active by default in the old systems of lore with sendmail; it also has security implications. As I understand it, the odds of this solving the OP problem in a modern system is low, but I can be wrong. – Rui F Ribeiro Aug 04 '16 at 15:38
  • `.forward` for plain old email forwarding should still work (it does on all my machines!), but using it to _filter_ mail... that got restricted a long time ago :-) – Stephen Harris Aug 04 '16 at 17:23
  • Simple forwarding should be enabled. At one time .forward could run any arbitrary program or script. The running of arbitrary programs or scripts is generally disabled. Forwarding to gmail or any other major freemail service may not work without acreditation. – BillThor Aug 05 '16 at 01:33
  • Hey it worked! (It took me a bit to figure out that it had been sent to spam via gmail.) – j0h Aug 05 '16 at 05:46