ERPNext v16 SMTP with Brevo returns 502 Please authenticate first

Hi,

This does not seem to be a simple configuration issue. The SMTP host, port, TLS settings, domain verification, SPF, and DKIM are all correctly configured.

We were also able to connect to the Brevo SMTP server manually from inside the Docker container and successfully send an email from the terminal. This confirms that the SMTP server, credentials, and network connectivity are working as expected.

Because of that, the issue seems to be related to how Frappe handles SMTP authentication with Brevo, rather than a basic SMTP or DNS configuration problem.

Has anyone successfully configured Brevo SMTP with ERPNext / Frappe v16?

Thanks.

Hi, any update on this issue?

We’ve done additional debugging and can confirm the problem is still reproducible on the latest versions:

  • Frappe: 16.17.2

  • ERPNext: 16.16.0

Current Findings

  • SMTP credentials are correct

  • TLS connection is established successfully

  • Authentication appears successful from the client perspective

  • However, Brevo rejects the MAIL FROM command with:

502 5.7.0 Please authenticate first

Key Observation

When using Python smtplib manually:

  • Default server.login() → FAIL (same issue as Frappe)

  • Forcing AUTH LOGIN explicitly → WORKS

server.auth("LOGIN", server.auth_login)

This confirms that:

Brevo requires explicit AUTH LOGIN negotiation, and automatic method selection (e.g. CRAM-MD5) is not compatible in this case.

Conclusion

Frappe’s SMTP wrapper does not allow enforcing the authentication mechanism, which leads to incompatibility with providers like Brevo.

Request

  • Is there any way to force AUTH LOGIN in Frappe’s SMTP client?

  • Or is there any planned fix / workaround for this?

This issue affects transactional email delivery and is critical for production use.

Thanks.

You should add smtp_no_ehlo_after_auth: true to your Site Config.

Foruma şunu yaz:


We had the same issue with Brevo SMTP on Frappe 16.17.2 (Docker deployment).

Solution: The fix is already included in v16.17.0+ but the setting is not available in the UI. You need to apply it via CLI:

bash

bench --site your-site.com set-config smtp_no_ehlo_after_auth 1
bench --site your-site.com clear-cache

For Docker deployments:

bash

docker exec -u frappe your-backend-container bench --site your-site.com set-config smtp_no_ehlo_after_auth 1
docker exec -u frappe your-backend-container bench --site your-site.com clear-cache

After this, Brevo SMTP works perfectly. No need to patch any source code.

Note: This setting is not exposed in System Settings or Email Account UI — it only exists in site_config.json. It would be helpful if it was added to the Email Account form.

1 Like