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.

I used to have a CPanel/Plesk server so I didn't setup email via command line etc.

I don't want an email pop3 account or mail server. Just want to forward "email@site.com" to "email@gmail.com" - can I do this using nginx?

K

share|improve this question

migrated from stackoverflow.com Nov 16 '11 at 13:55

This question came from our site for professional and enthusiast programmers.

    
I believe we might have a case of the XY Problem here (perlmonks.org/index.pl?node_id=5423410 and that the real question is "How do I set up my server to use gmail to process my email". If this is indeed the case, then this is a server configuration question that would probably be better asked on serverfault. BTW, I personally use this and it is not related to nginx or anyother webserver. –  Dayo Nov 11 '11 at 19:23
    
Very enlightening. Good luck with your quest. –  Dayo Nov 11 '11 at 23:01
    
what's your domain name registrar? –  Stefano Nov 14 '11 at 19:53

2 Answers 2

up vote 3 down vote accepted

There's a similar question here: nginx as mail proxy with a geeky answer but the very easy answer would be: no.

The thing is: while nginx does have a mail module and mail proxy features capable of handling smpt, imap, pop3 I'm having an hard time understanding which configuration does really require this. I'm not even sure it is compiled by default with pop/smpt/imap support, so you might have to rebuild it yourself. My point is not that you can't do it, just that it's overkill because there are easier ways.

This is a sample nginx conf (from here) for dealing with mail:

# To proxy pop3/imap/smtp recommended to set to the number of CPU
  worker_processes 1;

  error_log / var / log / nginx / error.log info;

  mail {
      server_name ORIGINALMAILSERVERNAME;
      auth_http LOCALSERVERAUTH; #NGINX FORWARDS AUTHENTICATION REQUESTS TO THIS URL

      imap_capabilities "IMAP4rev1" "UIDPLUS" "IDLE" "LITERAL +" "QUOTA";

      pop3_auth plain apop cram-md5;
      pop3_capabilities "LAST" "TOP" "USER" "PIPELINING" "UIDL";

      smtp_auth login plain cram-md5;
      smtp_capabilities "SIZE 10485760" ENHANCEDSTATUSCODES 8BITMIME DSN;
      xclient off;

      server {
          listen 25;
          protocol smtp;
          # The RFC 2821 timeout should be 300 seconds
          timeout 300s;
      }
      server {
          listen 110;
          protocol pop3;
          proxy on;
          proxy_pass_error_message on;
      }
      server {
          listen 143;
          protocol imap;
          proxy on;
      }
      server {
          listen 587;
          protocol smtp;
          timeout 300s;
      }
  }

In each of the Server { listen } section you can do whatever you want, including proxying to other severs such as gmail.

But I suppose you have bought a domain name: most domain name registrar still propose some interfaces to simply redirect emails - that's definitely the easiest way. Set up a catch-all to go to your gmail address.

Otherwise: edit your domain DNS settings, get a google app account and follow their tutorial; it's free up to 10 accounts: http://www.google.com/apps/intl/en/group/index.html and very easy.

You will need to edit your DNS settings. Depending on where you registered your 'mysite.com' domain name mileage will vary.

Unluckily I can't provide you with specific links, but you should do the following:

from there, you will get very detailed instructions.

There are probably other hosted mail solutions, and I do not work at google, but you want to read mails in a gmail interface so this should be the easiest way. I have myself a free google app account myself and very happy with it;

share|improve this answer
    
so nginx after all the hype cannot even be used as a mail server. whereas the dread, poor, pathetic APACHE and LAMP solution comes banging on my door again.. I'm left with a empty house.. –  TheBlackBenzKid Nov 14 '11 at 23:37
1  
uh i think you are misunderstanding what an email server is vs web server. If you want to forward your mail, just use the settings your domain provider gives you to setup forwarding. –  Martin Samson Nov 15 '11 at 5:13
    
what about nginx actually acting as a mail server? I have seen settings in conf files for smtp and other commands.. –  TheBlackBenzKid Nov 15 '11 at 8:38
    
@TheBlackBenzKid: why do you want to do something difficult when you can do something easy? I'm updating my answer with a few more details.. –  Stefano Nov 15 '11 at 9:55
1  
@TheBlackBenzKid: stackoverflow.com/questions/670628/… for open source "cpanels".. But really, doing DNS based mail configuration is the best way to use gmail: I can't imagine what nginx could provide more. I guess that your domain name registrar is Rackspace, so you should not even need DynDNS that provide paid-for mail redirection. –  Stefano Nov 15 '11 at 13:48

As stated by Stefano, no.

If you want to forward me@site.com to me@gmail.com, then go to your site.com email provider and setup forwarding for the account.

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.