Haproxy send-proxy and Ngonx Mail

I have had a lot of problems getting the real IP of the client with nginx as a mail proxy, this is my configuration

worker_processes auto;
events {
worker_connections 1024;
}

mail {
server_name mail.example.com;

# Autenticación externa vía HTTP
auth_http http://127.0.0.1:80/mail/auth.php;
proxy on;
proxy_pass_error_message on;

# SMTP
server {
    listen 587 proxy_protocol;
    protocol smtp;
    timeout 300s;
    smtp_auth login plain;
}

# IMAP
server {
    listen 143 proxy_protocol;
    protocol imap;
    timeout 300s;
}

# POP3 
server {
    listen 110 proxy_protocol;
    protocol pop3;
    timeout 300s;
}

}

Does anyone know how I could get it?