Config Mail Proxy for POP3/SMTP microsoft exchange

hcmnttan nginx-forum at nginx.us
Sat Oct 19 09:36:54 UTC 2013


Thanks Max,

I could config NGINX work for POP3, 
But in SMTP, I just could do auth login only, when send a test email, an
error message appear ( using telnet )
--------------------------------------------------
telnet 192.168.1.15 25

220 mailproxy ESMTP ready
auth login
334 VXNlcm5hbWU6
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
334 UGFzc3dvcmQ6
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
235 2.0.0 OK
mail from: nt.tan at abc.com.vn
250 2.1.0 Sender OK
rcpt to: nt.tan at abc.com.vn
250 2.1.5 Recipient OK
data
354 Start mail input; end with <CRLF>.<CRLF>
subject: Test mail
test
.
550 5.7.1 Client does not have permissions to send as this sender
--------------------------------------------------

I could do a test telnet from nginx to backend SMTP server. Could you help
??
Below is my config file


--------------------------------------------------
nginx.conf

user  nobody;
worker_processes  1;
error_log  logs/error.log  info;
pid        run/nginx.pid;

events {
  worker_connections  1024;
  multi_accept on;
}

http {
  perl_modules  perl/lib;
  perl_require  mailauth.pm;

  server {
    location /auth {
      perl  mailauth::handler;
    }
  }
}

mail {
  auth_http  127.0.0.1:80/auth;

  pop3_capabilities  "TOP"  "USER";
  smtp_capabilities "PIPELINING" "SIZE 10240000" "VRFY" "ETRN"
"ENHANCEDSTATUSCODES" "8BITMIME" "DSN";
  smtp_auth LOGIN ;
  xclient off;

  server {
    listen     110;
    protocol   pop3;
    proxy      on;
  }

  server {
    listen 25;
    protocol smtp;
    proxy on;
  }
}
--------------------------------------------------

mailauth.pm

package mailauth;
use nginx;

our $auth_ok;
our $protocol_ports={};
$cas="172.16.3.22";
$protocol_ports->{'pop3'}=110;
$protocol_ports->{'smtp'}=25;

sub handler {
    my $r = shift;
        $r->header_out("Auth-Status", "OK") ;
        $r->header_out("Auth-Server", $cas );
        $r->header_out("Auth-Port",
$protocol_ports->{$r->header_in("Auth-Protocol")});
        $r->send_http_header("text/html");
            return OK;
}
1;
__END__

--------------------------------------------------


Thanks in advance
Tan.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,243743,243856#msg-243856



More information about the nginx mailing list