How to Setup Mail Forwarding for Centos

Hi guys,

i build a CentOS Server and now i want to configure it and could need your help.
I searched the internet but didn't found something usefull.

So i am not that deep into linux so i apologize for the missing skills.

To the Topic:

I get some mails from services like SMARTctl or my own cronjobs i can access when logged in by typing "mail".

I want to configure, that the mails are forwardet to my private Mail account (only there or additional to the root account mail).
I created a mailaccount for my server that owncloud already uses to deliver mails. So the mailprogram should send the mails through that emailaccount.

I just found this https://www.digitalocean.com/community/tutorials/how-to-send-e-mail-alerts-on-a-centos-vps-for-system-monitoring
but it didn't helped me much.

So how could i make this or are there a few good documentations about the internal mail thing?

thank you in advace guys

Felix

If you have postfix installed all you need to do is edit your /etc/aliases file

#/etc/aliases
root: [email protected]
postmaster: root

once you've edited it to your liking run

$ sudo newaliases

check out the aliases(5) man page for tips on syntax, basically it's two columns separated by a colon, on the left the username of a local user, on the right a username or e-mail address of the person to forward the e-mails to.

If you want to forward messages conditionally, you'll want something else. procmail perhaps?