Configuring sendmail to use either gmail or iCloud as a mail forwarder has a lot of nice advantages.
It’s not particularly hard either, but it does require some configuration work. On Redhat based systems such as Fedora and Centos, you’ll need 5 packages:
NOTE: the last one is VERY important, without it, sendmail will NOT send email, and it will take you forever to figure it out! There are probably other dependencies, but dnf or yum will take care of them.
Once you have those, in /etc/mail, you’ll need to edit sendmail.mc and add, or comment in and edit to match,
RELAY_MAILER_ARGS',TCP $h 587′)dnl
root')dnl</span>hash -o /etc/mail/genericstable’)
<span style="font-family: 'courier new' , 'courier' , monospace;">FEATURE(masquerade_envelope)dnl</span>
<span style="font-family: 'courier new' , 'courier' , monospace;">FEATURE(genericstable,
Create a file called genericstable with one entry per line that maps your local user with your iCloud or gmail email address.
Some example entries:
Create a file called authinfo that contains an for which one you need for which service you’re using:
AuthInfo:smtp.me.com “U:icloud_name” “P:password” “M:PLAIN”
AuthInfo:smtp.gmail.com “U:gmail_name” “P:password” “M:PLAIN”
Obviously, change your icoud_name, or gmail_name to your login for which ever service your going to us, and password to your password for that service. It doesn’t hurt to have both entries in that file if you have accounts on both, but sendmail will use which ever one is specified in sendmail.mc as the SMART_HOST.
That’s it! Now run make while in /etc/mail, and it will build your config files with m4. Then add any entries in /etc/alias, for example to send root and your local account emails to you gmail account.
Finally restart sendmail and test:
# echo “testing from $(hostname) on $(date)” | mail -s “testing 001” root