[GH-ISSUE #558] v1.27.6 HELO/EHLO Issue with M365 #359

Closed
opened 2026-03-15 14:04:27 +03:00 by kerem · 9 comments
Owner

Originally created by @kjake on GitHub (Aug 25, 2025).
Original GitHub issue: https://github.com/axllent/mailpit/issues/558

Updated to v1.27.6 and now relaying to Exchange Online / Microsoft 365 has stopped working:
msg="[relay] error: error saying HELO/EHLO to [redacted].mail.protection.outlook.com:25: smtp: Hello called after other methods"

Originally created by @kjake on GitHub (Aug 25, 2025). Original GitHub issue: https://github.com/axllent/mailpit/issues/558 Updated to v1.27.6 and now relaying to Exchange Online / Microsoft 365 has stopped working: `msg="[relay] error: error saying HELO/EHLO to [redacted].mail.protection.outlook.com:25: smtp: Hello called after other methods"`
kerem closed this issue 2026-03-15 14:04:33 +03:00
Author
Owner

@kjake commented on GitHub (Aug 25, 2025):

Rolled back to v1.27.5, exported messages and then ingested and they're relaying appropriately now.

<!-- gh-comment-id:3220348164 --> @kjake commented on GitHub (Aug 25, 2025): Rolled back to v1.27.5, exported messages and then ingested and they're relaying appropriately now.
Author
Owner

@axllent commented on GitHub (Aug 25, 2025):

Oh no, that's unfortunate. This is definitely related to a recent change submitted by @petek. Pete, any ideas? This error originates within the Go SMTP client if Helo has already been called earlier on in the transaction (or maybe connection).

<!-- gh-comment-id:3221501329 --> @axllent commented on GitHub (Aug 25, 2025): Oh no, that's unfortunate. This is definitely related to a recent change submitted by @petek. Pete, any ideas? This error originates within the Go SMTP client if Helo has already been called earlier on in the transaction (or maybe connection).
Author
Owner

@petek commented on GitHub (Aug 25, 2025):

Moving the HELO block above the STARTTLE block should fix the error.

According to protocol, STARTTLS is supposed to reset the connection, hence why the HELO should go there. But it appears the client does not agree and moving the block may be necessary.

<!-- gh-comment-id:3221844821 --> @petek commented on GitHub (Aug 25, 2025): Moving the HELO block above the STARTTLE block should fix the error. According to protocol, STARTTLS is supposed to reset the connection, hence why the HELO should go there. But it appears the client does not agree and moving the block may be necessary.
Author
Owner

@axllent commented on GitHub (Aug 25, 2025):

Thank you for your input @petek. I suspect you are correct (StartTLS() sets this if it hasn't already been set here), although the only way to be 100% sure is to test this.

If I was to make a change to address this, would you both be able to test this for me to confirm it works with the relay services, before I do any future Mailpit releases? This would mean you would both have to test with the axllent/mailpit:edge Docker image after I made the change.

<!-- gh-comment-id:3221964604 --> @axllent commented on GitHub (Aug 25, 2025): Thank you for your input @petek. I suspect you are correct (`StartTLS()` sets this if it hasn't already been set [here](https://github.com/golang/go/blob/master/src/net/smtp/smtp.go#L155-L157)), although the only way to be 100% sure is to test this. If I was to make a change to address this, would you both be able to test this for me to confirm it works with the relay services, **before** I do any future Mailpit releases? This would mean you would both have to test with the `axllent/mailpit:edge` Docker image after I made the change.
Author
Owner

@kjake commented on GitHub (Aug 25, 2025):

Yes! It wouldn't be hard for me to test that.
fwiw, I do have starttls: true in my relayconfig.

<!-- gh-comment-id:3221988964 --> @kjake commented on GitHub (Aug 25, 2025): Yes! It wouldn't be hard for me to test that. fwiw, I do have `starttls: true` in my relayconfig.
Author
Owner

@axllent commented on GitHub (Aug 26, 2025):

I have pushed the change to the develop branch (which is used to build the edge docker image). @kjake & @petek - please could you both test using the latest axllent/mailpit:edge build and confirm this works for both of you (ie: Google & MS relay services)? Thank you.

<!-- gh-comment-id:3222146730 --> @axllent commented on GitHub (Aug 26, 2025): I have pushed the change to the `develop` branch (which is used to build the edge docker image). @kjake & @petek - please could you both test using the **latest** `axllent/mailpit:edge` build and confirm this works for both of you (ie: Google & MS relay services)? Thank you.
Author
Owner

@petek commented on GitHub (Aug 26, 2025):

This has worked for me in my local environment. @axllent @kjake

<!-- gh-comment-id:3224236806 --> @petek commented on GitHub (Aug 26, 2025): This has worked for me in my local environment. @axllent @kjake
Author
Owner

@kjake commented on GitHub (Aug 26, 2025):

Worked here too!

Using axllent/mailpit:edge@sha256:52ac6714e0e572bda3ff3ad5282b4e76db005c882ccbb85ea511329f8e87796b:

time="2025/08/26 15:57:56" level=debug msg="[relay] sent message to [redacted] from [redacted] via [redacted]-com.mail.protection.outlook.com:25"
<!-- gh-comment-id:3225560674 --> @kjake commented on GitHub (Aug 26, 2025): Worked here too! Using `axllent/mailpit:edge@sha256:52ac6714e0e572bda3ff3ad5282b4e76db005c882ccbb85ea511329f8e87796b`: ``` time="2025/08/26 15:57:56" level=debug msg="[relay] sent message to [redacted] from [redacted] via [redacted]-com.mail.protection.outlook.com:25" ```
Author
Owner

@axllent commented on GitHub (Aug 27, 2025):

Thank you both for testing & confirming. I have just released the patch fix for this in v1.27.7 (currently no difference to the edge build you just tested).

<!-- gh-comment-id:3226687480 --> @axllent commented on GitHub (Aug 27, 2025): Thank you both for testing & confirming. I have just released the patch fix for this in [v1.27.7](https://github.com/axllent/mailpit/releases/tag/v1.27.7) (currently no difference to the edge build you just tested).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#359
No description provided.