[GH-ISSUE #542] 127.0.0.1 alias to localhost in mailpit sendmail (invalid address: 127.0.0.1:1025 in v1.27.2) #347

Closed
opened 2026-03-15 14:00:41 +03:00 by kerem · 5 comments
Owner

Originally created by @stasadev on GitHub (Jul 28, 2025).
Original GitHub issue: https://github.com/axllent/mailpit/issues/542

We started seeing failed container tests for Mailpit in DDEV:

https://github.com/ddev/ddev/actions/runs/16557332228/job/46849011812#step:7:3266

127.0.0.1:1025 doesn't work anymore in v1.27.2:

sendmail_path="/usr/local/bin/mailpit sendmail -t --smtp-addr 127.0.0.1:1025"

From PHP logs:

invalid address: 127.0.0.1:1025

Although localhost:1025 works fine:

sendmail_path="/usr/local/bin/mailpit sendmail -t --smtp-addr localhost:1025"

Caused by github.com/axllent/mailpit@e1ed21abff


Not sure if it's worth chasing since we can change it in our code, but this logic has worked for years.

Originally created by @stasadev on GitHub (Jul 28, 2025). Original GitHub issue: https://github.com/axllent/mailpit/issues/542 We started seeing failed container tests for Mailpit in DDEV: https://github.com/ddev/ddev/actions/runs/16557332228/job/46849011812#step:7:3266 `127.0.0.1:1025` doesn't work anymore in v1.27.2: ```ini sendmail_path="/usr/local/bin/mailpit sendmail -t --smtp-addr 127.0.0.1:1025" ``` From PHP logs: ``` invalid address: 127.0.0.1:1025 ``` Although `localhost:1025` works fine: ```ini sendmail_path="/usr/local/bin/mailpit sendmail -t --smtp-addr localhost:1025" ``` Caused by https://github.com/axllent/mailpit/commit/e1ed21abff8d73d86a0725b58d6e0b358c933284 --- Not sure if it's worth chasing since we can change it in our code, but this logic has worked for years.
kerem closed this issue 2026-03-15 14:00:46 +03:00
Author
Owner

@axllent commented on GitHub (Jul 28, 2025):

Hmmmm, I can't see why this would cause any change in behaviour. This should work exactly as it was before, except if the smtpd is configured to use TLS, then sendmail won't complain if the certificate can't be validated. The smtp.SendMail() function which was previously used was copied almost 1:1.

Are you sure this issue is related to Mailpit? Does switching back to the previous version of Mailpit solve the problem?

<!-- gh-comment-id:3127015372 --> @axllent commented on GitHub (Jul 28, 2025): Hmmmm, I can't see why this would cause any change in behaviour. This should work exactly as it was before, except if the smtpd is configured to use TLS, then sendmail won't complain if the certificate can't be validated. The `smtp.SendMail()` function which was previously used was copied almost 1:1. Are you sure this issue is related to Mailpit? Does switching back to the previous version of Mailpit solve the problem?
Author
Owner

@stasadev commented on GitHub (Jul 28, 2025):

The problem is this new check:

github.com/axllent/mailpit@7423b9660b/sendmail/cmd/smtp.go (L77-L81)

url.Parse doesn't recognize 127.0.0.1:1025

Reproduce https://go.dev/play/p/Mi0HqTgCoLi

<!-- gh-comment-id:3127035958 --> @stasadev commented on GitHub (Jul 28, 2025): The problem is this new check: https://github.com/axllent/mailpit/blob/7423b9660bdf57daf2de1f4034e6f79f0ab86383/sendmail/cmd/smtp.go#L77-L81 `url.Parse` doesn't recognize `127.0.0.1:1025` Reproduce https://go.dev/play/p/Mi0HqTgCoLi
Author
Owner

@axllent commented on GitHub (Jul 28, 2025):

Yeah sorry, I was just about to confirm that I can reproduce this.... will find a solution and get back to you.

<!-- gh-comment-id:3127046612 --> @axllent commented on GitHub (Jul 28, 2025): Yeah sorry, I was just about to confirm that I can reproduce this.... will find a solution and get back to you.
Author
Owner

@axllent commented on GitHub (Jul 28, 2025):

I've fixed the bug and just released a new version . Please confirm this works for you? If you need the docker image then you'll need to wait about 10 minutes for it to finish building.

<!-- gh-comment-id:3127234485 --> @axllent commented on GitHub (Jul 28, 2025): I've fixed the bug and just released [a new version](https://github.com/axllent/mailpit/releases/tag/v1.27.3) . Please confirm this works for you? If you need the docker image then you'll need to wait about 10 minutes for it to finish building.
Author
Owner

@stasadev commented on GitHub (Jul 28, 2025):

Thank you!

I confirm that it works https://github.com/ddev/ddev/actions/runs/16557332228/job/46861491730

<!-- gh-comment-id:3127353593 --> @stasadev commented on GitHub (Jul 28, 2025): Thank you! I confirm that it works https://github.com/ddev/ddev/actions/runs/16557332228/job/46861491730
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#347
No description provided.