Haproxy SSL/TLS Passthrough Proxy not working?

I want to setup haproxy as simple tcp-proxy. Below is my configuration. When I try to send e-mail via Thunderbird(pointing smtp to ip_of_my_host:8123) or simple python script I get an error about not valid certificate or certificate error. I thought Layer 4 doesn’t care about it at all. Isn’t SSL/TLS a L7 feature? So how setup it properly?

frontend smtp
  bind *:8123
  mode tcp
  default_backend smtp-backend

  backend smtp-backend
  mode tcp
  server s1 smtp.gmail.com:465

With SSL Pass-Through, no SSL certificates need to be created or used within HAproxy. The backend servers can handle SSL connections just as they would if there was only one server used in the stack without a load balancer.

So what’s wrong with my configuration? I want end smtp server to handle certificates.

one quick guess:

your client sends request to but gets an certificate with smtp.gmail.com. in this case “” != “smtp.gmail.com” and so the complaint is correct. client always match the name/domain of SSL Certificate with the url/domain entered in the adress bar.