Is there a way to send an email to my Gmail account, each time I get a system email from Ubuntu?
I'm using Ubuntu 22.10 and has Sendmail installed and working (sending emails from/to my Gmail account). When I ssh to the machine, I sometimes see a notification about having a new email waiting (from the server). I would like to receive a notification on my Gmail each time I gat such an email.
I was looking at solutions to possibly use a cron job with Sendmail to achieve this, but I don't know how to design and trigger it. I didn't find any tutorials and it seems to be beyond the scopes of my current knowledge.
Any ideas or alternative solutions will be very appreciated!
Thanks
Edit - some more info:
I've been using Linux for years and thought I knew enough about Ubuntu, but this "system-email" thing got me stuck.
So I first encountered it recently with ddclient
, where there's an option to get emails on failure:
mail=root
mail-failure=root
I can read them be running mail
from the terminal. This example and others like it, are email notifications from parts of the system, and I just think it would be great to have them sent or forwarded directly to my personal Gmail. I got Sendmail
connected to my Gmail account, and that's where I'm stuck now.
Example - when I ssh to the server, I get this message (the last line):
Welcome to Ubuntu 22.10 (GNU/Linux 5.19.0-1006-raspi aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
2 updates can be applied immediately.
2 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable
You have new mail.