How I (simply) Forward All Incoming Email to an External Address (ie. Gmail)?

Solution 1:

With sendmail you need to add something like this at the end of you /etc/mail/sendmail.mc:

LOCAL_CONFIG
Kuser user -m -a.FOUND

LOCAL_RULE_0
R$- < @ $=w . > $*        $: $(user $1 $) < @ $2 . > $3
R$- . FOUND < @ $=w . > $*          $@ username < @ gmail.com. > $3

That would forward any email directed to a user of the system (listed in /etc/passwd) to your [email protected]. Keep in mind that the left hand side of the rules is separated from the right hand side of the rules with tabs and not spaces. So do not copy paste, type the above rules instead. After that you need to run /etc/mail/make to build sendmail.cf and service sendmail restart in order for the changes to take place.