Passing the original client EHLO to the SMTP backend

kay nginx-forum at forum.nginx.org
Wed Jul 21 19:57:14 UTC 2021


I've managed to get the desired result with a patch below:

--- a/src/mail/ngx_mail_proxy_module.c
+++ b/src/mail/ngx_mail_proxy_module.c
@@ -574,7 +574,7 @@
 
         cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
 
-        line.len = sizeof("HELO ")  - 1 + cscf->server_name.len + 2;
+        line.len = sizeof("HELO ")  - 1 + s->smtp_helo.len + 2;
         line.data = ngx_pnalloc(c->pool, line.len);
         if (line.data == NULL) {
             ngx_mail_proxy_internal_server_error(s);
@@ -587,7 +587,7 @@
                        ((s->esmtp || pcf->xclient) ? "EHLO " : "HELO "),
                        sizeof("HELO ") - 1);
 
-        p = ngx_cpymem(p, cscf->server_name.data, cscf->server_name.len);
+        p = ngx_cpymem(p, s->smtp_helo.data, s->smtp_helo.len);
         *p++ = CR; *p = LF;
 
         if (pcf->xclient) {

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,292085,292088#msg-292088



More information about the nginx mailing list