Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to set the root mail address to my gmail address? And if so how?

Would it work by just setting my email address in the following file?

/etc/aliases :

root: mygmail@gmail.com

Or does it need to be a domain that is hosted on my webserver?

As a side note: not really sure this has to do with postfix I'm just starting to use freebsd as webserver trying to setup a mailserver using this tutorial

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Yes you can send email to an account outside your mailserver. But, it might not work out of the box.

Test it first from the commandline:

[root@host ~]# /usr/bin/mail -s "Test from $HOSTNAME" mygmail@gmail.com

If the mail does not arrive at your gmail account, then you should see a reason why in /var/log/maillog . The most common reason that I see is that the host does not know how to route mail to the outside world, or does not have a Smarthost configured in /etc/mail/sendmail.cf

share|improve this answer
    
+1 Good point. Not every system will send mail to an external destination without some configuration. –  John Gardeniers Feb 11 '12 at 0:04
1  
For Postfix, that should be /etc/postfix/main.cf and not something like /etc/mail/sendmail.cf. –  wzzrd Feb 11 '12 at 7:45
    
actually In this case I'm using postfix but testing It like this is very usefull. –  FLY Feb 13 '12 at 14:31

This will work, but you may have to set parameter append_at_myorigin=no in main.cf in case myorigin is set. Otherwise if you are sending locally to "root" postfix by default will append myorigin value to the domain part of the recipient.

share|improve this answer

This will work fine. I forward root mail to off site mail addresses all the time.

share|improve this answer

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.