Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to set up the redirection of all emails to my VPS to my Gmail account because it's easier to handle. At the moment though, it is not working, and I can't see why.

I have tried a few solutions from the Internet but none have worked so far (I tell you this because I realize there may be a chance that things are conflicting). My VPS is running on CentOS 5.

Postfix is the most popular solution, and this is what I have done:

  • Edited /etc/postfix/main.cf to add:

    virtual_alias_domains = mydomain.com
    virtual_alias_maps = hash:/etc/postfix/virtual
    
  • Created /etc/postfix/virtual and added:

    admin@mydomain.com   mygmail@gmail.com
    @mydomain.com   mygmail@gmail.com
    
  • Then ran postmap /etc/postfix/virtual and service postfix reload and service postfix restart

There is nothing in my /var/log/maillog but the only contents is the activity of me restarting the server etc. As a side note, if I send mail from the server command line to admin@mydomain.com, it redirects to my Gmail.

Am I doing anything obviously wrong? I followed an article to the letter on this and many other articles recommend the same or a very similar process. If you need any more info then I will be happy to give it to you - any help is greatly appreciated.

share|improve this question
    
Before you set this up, could you actually send mail from the Internet into your VPS using your @mydomain.com address? Does mydomain.com have either an MX record, or an A record on the mydomain.com entry which points to your VPS? –  EightBitTony Jul 16 '13 at 19:55
    
Is there a firewall in the way, is postfix listening on the right ports/interfaces? –  EightBitTony Jul 16 '13 at 19:55
    
Why don't you simply set up Gmail as your MX? –  tripleee Jul 17 '13 at 6:53
    
@EightBitTony - I don't believe it worked, no. I have a MX record set-up that points to mydomain.com as well as an A record for mydomain.com which points to my VPS' IP address. On the firewall/ports: I just tried to telnet mydomain.com on port 25, and I got the error that the connection timed out. As far as I know, there is no firewall in place - at least, I haven't had any part in installing one. –  jbirch Jul 17 '13 at 8:39
    
Then either there is a firewall (iptables) in place, or you haven't configured postfix to listen on the internet facing IP address (are you sure it's not just listening on localhost?) –  EightBitTony Jul 17 '13 at 9:03

1 Answer 1

It's likely that postfix is listening on localhost only (so local connections work, but external don't). You need to look at main.cf and ensure you've told postfix to listen on all interfaces you need to connect to it over.

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.