I would like to forward mail that gets sent root@localhost on multiple servers to our company admin account (e-mail is hosted on gmail)
I have installed ssmtp on centos 5.5 via yum and configured it. i've also changed the last line in /etc/aliases to reflect where mail to root should go to.
I've then tried sending mail to root - this gets delivered without a problem (mail -v root) I've also tried sending mail to root@localhost - this is not delivered to the specified gmail account.
Unfortunately,
ssmtp
does not read~/.forward
. Here is a quote from thessmtp
manpage.This is a an old post. However, this may useful to some one else.
Based on this link https://theblackdragon.wordpress.com/2011/06/07/ssmtp-and-aliasing-the-to-address/
mailx -?
)Edit /etc/mail.rc like this:
alias root root<[email protected]>
Now, mails to root@localhost will be sent to [email protected] You can add other addresses too, not just root.
Have you configured and enabled From rewriting?
locahost
is not a valid domain.See this post.