代码改变世界

如何设置mail alias

2014-05-06 10:57  三犬风  阅读(932)  评论(0编辑  收藏  举报

Use Case: admin needs to be notified when appuser task is failed, the notification email is sent to appuser by default(check with the command 'mail'), however, we need the notification email to be sent to admin.

1. Login with root user ID

2. Edit the /etc/aliases file (with vi editor)

3. Append / change an email alias in this format

alias_name:   email_id1 [, email_id2,] ...


E.g. append this new email alias to the /etc/aliases

appuser:   admin@xx.com

4. Save and exit the alias file

5. Execute the newaliases command followed by echo $?(suppose there is no error found, you will get a 0 returned by the echo command).