Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a Debian server and have monit installed and running. I use the following settings for alert mails:

set mailserver localhost   # primary mailserver
set mail-format { from: monit@abc.test }
set alert admin@abc.test

I've started monit manually, and that resulted in local mails, to root@localhost. I want to receive mails via my personal mail address. I have postfix installed, and other applications (like Wordpress) can send out mails.

Why doesn't that work, and how can I get it working?

@Zoredache suggests to forward the mail to root@localhost to my own address. That sounds like a good solution. Now I'm wondering how I can get that working.

share|improve this question
    
Getting this setup right sounds good, but is there some reason why you couldn't just set an alias on the system to forward the mail from root@localhost to the address you prefer? –  Zoredache Feb 10 '12 at 21:54
    
Thank you. I just updated the question with your suggestion. –  rxt Feb 10 '12 at 22:48
add comment

1 Answer

up vote 0 down vote accepted

To create an alias under most mail servers, and I believe postfix, just update the systema alias file /etc/aliases. It almost certainly already exists, so you just have to go in and add or update a line.

root: me@example.com
share|improve this answer
    
I update this line, restarted monit, which results in a new mail sent. I don't login as root, but as user rxt. The mail is sent to this user, not to the root user. This confuses me a bit, because I start monit as root. So the mail doesn't arrive at the moment. –  rxt Feb 10 '12 at 23:22
    
You would have to look at your existing aliases. Perhaps monit is sending to some other address that is already getting aliased to rxt? –  Zoredache Feb 10 '12 at 23:28
    
The mailto address I used was on the same domain as the domain name for the machine. In the above example I used admin@abc.test, while abc.test pointed to this server, and admin was the username. The MX records for the mail for this domain points to a different server with a different provider, so I didn't consider that a problem. Now I've used a gmail address (root: abctest@gmail.com), and I reloaded the aliases with the command "newaliases". And voila! It works! :-) –  rxt Feb 11 '12 at 20:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.